PHP code example of hypejunction / menus_api

1. Go to this page and download the library: Download hypejunction/menus_api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hypejunction / menus_api example snippets


$menu_items = menus_api_combine_menus([
    'entity',
    'owner_block',
    'user_hover'
], [
    'entity' => $user,
]);

$params = menus_api_prepare_params('user_hover', ['entity' => 'user]);
$items = menus_api_get_menu('user_hover', $params);

$item = ElggMenuItem::factory([
    'name' => 'messages',
    'text' => 'New messages',
    'href' => '/messages',
    'data' => [
        'indicator' => 5,
        'icon' => 'envelope',
        '

echo menus_api_view_menu('user_hover', [
    'entity' => $user,
    'sections' => ['admin', 'action'],
    'sort_by' => 'priority',
]);

$parent = ElggMenuItem::factory([
	'name' => 'parent',
	'text' => 'Parent',
	'data' => [
		'subsections' => ['actions', 'admin']
	]
]);


$item = ElggMenuItem::factory([
	'name' => 'action',
	'parent_name' => 'parent',
	'text' => 'Action',
	'data' => [
		'subsection' => 'actions'
	]
]);