Menu

Functions


// Retrieve menu by alias = 'main_menu'
get_menu_by('alias', 'main_menu');

mixed get_menu_by ( $key, $value, $options = [] )
$key string
  • id - menu id
  • alias - menu alias
  • language - menu language
$value mixed The value
$options array
  • id (int/array) - menu id
  • alias (string/array) - menu alias
  • language (int/array) - menu status
  • order (string) - menu order (by default id ASC)
  • cache (boolean) - cache the menu (by default true)
Returns array of Menu object collection or single Menu object.

// The main difference of function get_menu_by that get_nav_by return ready menu array for use with yii2 nav widgets. 
    
// Retrieve nav by alias = 'main_menu'
get_nav_by(['alias', 'main_menu']);

// Use with yii2 nav widgets 
Nav::widget([
    'items' => get_nav_by('alias', 'main_menu'),
]);

mixed get_nav_by ( $key, $value, $options = [] )
$key string
  • id - menu id
  • alias - menu alias
  • language - menu language
$value mixed The value
$options array
  • id (int/array) - menu id
  • alias (string/array) - menu alias
  • language (int/array) - menu status
  • order (string) - menu order (by default id ASC)
  • cache (boolean) - cache the menu (by default true)
Returns array of Menu object collection or single Menu object.

Menu Type Object

$id int Photo id
$title string Menu type title
$menu_type_alias string Menu type alias
$description string Menu type description
$menu object collection Menu (relation)

Menu Object

$id int Menu id
$menu_type_id int Related menu type id
$status int Menu status
$title string Menu title
$link string Menu link
$note string Menu note
$parent_id int Related menu parent id
$language string Menu language
$depth int Menu depth
$lft int Menu nested left key
$rgt int Menu nested right key
$menuType object Menu type (relation)