Topics

Class Helper

Get menu item arrays for menu generation

Namespace: Ip\Menu

Methods:

array getMenuItems( string $menuName , [ integer $depthFrom = 1 ] , [ integer $depthTo = 1000 ] , [ string $orderBy = null ] )

Get specific levels of menu.

Common usage: Get items of a first menu level (to display on top of the site), e.g., $result = \Ip\Menu\Helper::getMenuItems('menu1', 1, 1); Get 7 levels of children of selected page on top menu (to display on a side): $result = \Ip\Menu\Helper::getMenuItems('menu1', 2, 7);

Pass the result to ipSlot('menu', array('items' => $result));

Please note, that items of a child level can only be returned if a selected page is in a breadcrumb parent page. In opposite case, the function returns an empty array.

Parameters:

string $menuName eg menu1
integer $depthFrom
integer $depthTo
string $orderBy can be set to 'title' to change ordering

Return values:

array

Throws:

Ip\Exception
array getChildItems( [ integer|string $pageId = null ] , [ integer $depthLimit = 1000 ] , [ string $orderBy = null ] )

Get children items of current or specified page.

Parameters:

integer|string $pageId pageId or an alias
integer $depthLimit limit the depth of items to be returned
string $orderBy can be set to 'title' to change ordering

Return values:

array
comments powered by Disqus