Jet\Navigation_Menu

Represents menu.

Menu overview

Method Meaning of
public __construct(
string $id,
string $label,
int $index,
string $icon=''
)
Parameters:
  • $id
    Menu identifier.
  • $label
    Menu label.
  • $index
    Index - order / priority of the menu.
  • $icon
    Optional menu icon.
public setParentMenu(
Navigation_Menu $parent_menu
) : void
Sets any parent menu (if it is a nested menu).
public getParentMenu(
) : Navigation_Menu|null
Returns the parent menu, if any (if it is a nested menu).
public getId(
bool $absolute=true
) : string
Returns the menu identifier. If $absolute is false, then only the partial ID of the menu. If the parameter is true and the menu has a parent, then it returns an ID of the form "paren_imenu_id/menu_id".
public setId(
string $id
) : void
Sets the menu ID.
public getLabel(
) : string
Returns the menu label (already translated, if translation is performed).
public setLabel(
string $label
) : void
Sets the menu label.
public getIndex(
) : int
Returns the index - the order / priority of the menu.
public setIndex(
int $index
) : void
Sets the index - the order / priority of the menu.
public getIcon(
) : string
Returns the name of the menu icon.
public setIcon(
string $icon
) : void
Sets the menu icon.
public addItem(
Navigation_Menu_Item $item
) : void
Adds an item to the menu.
public addMenu(
Navigation_Menu $menu
) : void
Adds a submenu to the menu.
public getAccessAllowed(
) : bool
Verifies that the menu is accessible to the current user in terms of authentication and authorization.
public getItems(
bool $check_access=true
) : Navigation_Menu_Item[]|Navigation_Menu[]
Returns the menu items and any submenus.

If the $check_access parameter is true, it performs a permission check and returns only those items that the user has access to.
public setItems(
Navigation_Menu_Item[]|Navigation_Menu[]& $items
) : void
Sets the items (and any submenus) in bulk.
public static sortMenuItems(
Navigation_Menu_Item[]|Navigation_Menu[]& $items
) : void
A general method for sorting menu items.
public toArray(
) : array
Converts the menu definition to the associated field (preparing to save the definition).
Previous chapter
Jet\Navigation_MenuSet
Next chapter
Jet\Navigation_Menu_Item