Elgg  Version 2.3
Public Member Functions | List of all members
Elgg\Menu\Service Class Reference

Methods to construct and prepare menus for rendering. More...

Public Member Functions

 __construct (PluginHooksService $hooks, Config $config)
 Constructor. More...
 
 getMenu ($name, array $params=[])
 Build a full menu, pulling items from configuration and the "register" menu hooks. More...
 
 getUnpreparedMenu ($name, array $params=[])
 Build an unprepared menu. More...
 
 prepareMenu (UnpreparedMenu $menu)
 Split a menu into sections, and pass it through the "prepare" hook. More...
 
 combineMenus (array $names=[], array $params=[], $new_name= '')
 Combine several menus into one. More...
 
 prepareMenuItems (array $items=[])
 Prepare menu items. More...
 

Detailed Description

Methods to construct and prepare menus for rendering.

Definition at line 12 of file Service.php.

Constructor & Destructor Documentation

Elgg\Menu\Service::__construct ( PluginHooksService  $hooks,
Config  $config 
)

Constructor.

Parameters
PluginHooksService$hooksPlugin hooks
Config$configElgg config private

Definition at line 32 of file Service.php.

Member Function Documentation

Elgg\Menu\Service::combineMenus ( array  $names = [],
array  $params = [],
  $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$paramsMenu params
string$new_nameCombined menu name (used for the prepare hook)
Returns
UnpreparedMenu

Definition at line 116 of file Service.php.

Elgg\Menu\Service::getMenu (   $name,
array  $params = [] 
)

Build a full menu, pulling items from configuration and the "register" menu hooks.

Parameters are filtered by the "parameters" hook.

Parameters
string$nameMenu name
array$paramsHook/view parameters
Returns
Menu

Definition at line 47 of file Service.php.

Elgg\Menu\Service::getUnpreparedMenu (   $name,
array  $params = [] 
)

Build an unprepared menu.

Parameters
string$nameMenu name
array$paramsHook/view parameters
Returns
UnpreparedMenu

Definition at line 59 of file Service.php.

Elgg\Menu\Service::prepareMenu ( UnpreparedMenu  $menu)

Split a menu into sections, and pass it through the "prepare" hook.

Parameters
UnpreparedMenu$menuMenu
Returns
Menu

Definition at line 90 of file Service.php.

Elgg\Menu\Service::prepareMenuItems ( array  $items = [])

Prepare menu items.

Parameters
array$itemsAn array of ElggMenuItem instances or menu item factory options
Returns
ElggMenuItem[]

Definition at line 146 of file Service.php.


The documentation for this class was generated from the following file: