Methods to construct and prepare menus for rendering.
More...
Methods to construct and prepare menus for rendering.
Definition at line 11 of file Service.php.
◆ __construct()
Constructor.
- Parameters
-
Definition at line 24 of file Service.php.
◆ combineMenus()
Elgg\Menu\Service::combineMenus |
( |
array |
$names = [] , |
|
|
array |
$params = [] , |
|
|
string |
$new_name = '' |
|
) |
| |
Combine several menus into one.
Unprepared menus will be built separately, then combined, with items reassigned to sections named after their origin menu. The returned menu must be prepared before display.
- Parameters
-
string[] | $names | Menu names |
array | $params | Menu params |
string | $new_name | Combined menu name (used for the prepare event) |
- Returns
- \Elgg\Menu\UnpreparedMenu
Definition at line 282 of file Service.php.
◆ getAllMenus()
Elgg\Menu\Service::getAllMenus |
( |
| ) |
|
Returns all registered menu items.
Used for debugging purpose.
- Returns
- \ElggMenuItem[]
- Since
- 5.0
Definition at line 381 of file Service.php.
◆ getMenu()
Elgg\Menu\Service::getMenu |
( |
string |
$name, |
|
|
array |
$params = [] |
|
) |
| |
Build a full menu, pulling items from configuration and the "register" menu events.
Parameters are filtered by the "parameters" event.
- Parameters
-
string | $name | Menu name |
array | $params | Event/view parameters |
- Returns
- \Elgg\Menu\Menu
Definition at line 37 of file Service.php.
◆ getUnpreparedMenu()
Elgg\Menu\Service::getUnpreparedMenu |
( |
string |
$name, |
|
|
array |
$params = [] |
|
) |
| |
Build an unprepared menu.
- Parameters
-
string | $name | Menu name |
array | $params | Event/view parameters |
- Returns
- \Elgg\Menu\UnpreparedMenu
Definition at line 49 of file Service.php.
◆ prepareDropdownMenu()
Elgg\Menu\Service::prepareDropdownMenu |
( |
PreparedMenu |
$menu, |
|
|
array |
$params |
|
) |
| |
|
protected |
Prepares a dropdown menu.
- Parameters
-
PreparedMenu | $menu | the current prepared menu |
array | $params | the menu params |
- Returns
- \Elgg\Menu\PreparedMenu
Definition at line 203 of file Service.php.
◆ prepareItemContentsView()
Elgg\Menu\Service::prepareItemContentsView |
( |
PreparedMenu |
$menu, |
|
|
array |
$params |
|
) |
| |
|
protected |
Set a content view for each menu item based on the default for the menu.
- Parameters
-
PreparedMenu | $menu | the current prepared menu |
array | $params | the menu params |
- Returns
- \Elgg\Menu\PreparedMenu
- Since
- 4.2
Definition at line 246 of file Service.php.
◆ prepareMenu()
Split a menu into sections, and pass it through the "prepare" event.
- Parameters
-
- Returns
- \Elgg\Menu\Menu
Definition at line 95 of file Service.php.
◆ prepareMenuItems()
Elgg\Menu\Service::prepareMenuItems |
( |
array |
$items = [] | ) |
|
Prepare menu items.
- Parameters
-
array | $items | An array of \ElggMenuItem instances or menu item factory options |
- Returns
- \Elgg\Menu\MenuItems
Definition at line 317 of file Service.php.
◆ prepareSelectedParents()
Elgg\Menu\Service::prepareSelectedParents |
( |
PreparedMenu |
$menu, |
|
|
array |
$params |
|
) |
| |
|
protected |
Marks parents of selected items also as selected.
- Parameters
-
PreparedMenu | $menu | the current prepared menu |
array | $params | the menu params |
- Returns
- \Elgg\Menu\PreparedMenu
Definition at line 179 of file Service.php.
◆ prepareVerticalMenu()
Elgg\Menu\Service::prepareVerticalMenu |
( |
PreparedMenu |
$menu, |
|
|
array |
$params |
|
) |
| |
|
protected |
Prepares a vertical menu by setting the display child menu option to "toggle" if not set.
- Parameters
-
PreparedMenu | $menu | the current prepared menu |
array | $params | the menu params |
- Returns
- \Elgg\Menu\PreparedMenu
Definition at line 142 of file Service.php.
◆ registerMenuItem()
Elgg\Menu\Service::registerMenuItem |
( |
string |
$menu_name, |
|
|
\ElggMenuItem |
$menu_item |
|
) |
| |
Register a menu item.
- Parameters
-
string | $menu_name | The name of the menu |
mixed | $menu_item | An \ElggMenuItem object |
- Returns
- void
- Since
- 5.0
Definition at line 345 of file Service.php.
◆ unregisterMenuItem()
Elgg\Menu\Service::unregisterMenuItem |
( |
string |
$menu_name, |
|
|
string |
$item_name |
|
) |
| |
Remove an item from a menu.
- Parameters
-
string | $menu_name | The name of the menu |
string | $item_name | The unique identifier for this menu item |
- Returns
- \ElggMenuItem|null
- Since
- 5.0
Definition at line 358 of file Service.php.
◆ $menus
Elgg\Menu\Service::$menus = [] |
|
protected |
The documentation for this class was generated from the following file: