PHP Class Ip\Menu\Helper

Mostra file Open project: impresspages/impresspages Class Usage Examples

Public Methods

Method Description
getChildItems ( integer | string $pageId = null, integer $depthLimit = 1000, string $orderBy = null ) : array Get children items of current or specified page.
getMenuItems ( string $menuName, integer $depthFrom = 1, integer $depthTo = 1000, string $orderBy = null ) : array Get specific levels of menu.

Private Methods

Method Description
arrayToMenuItem ( array $pages, integer $depth, integer $curDepth, string $order ) : array
existInBreadcrumb ( string $link ) : boolean

Method Details

getChildItems() public static method

Get children items of current or specified page.
public static getChildItems ( integer | string $pageId = null, integer $depthLimit = 1000, string $orderBy = null ) : array
$pageId integer | string pageId or an alias
$depthLimit integer limit the depth of items to be returned
$orderBy string can be set to 'title' to change ordering
return array

getMenuItems() public static method

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.
public static getMenuItems ( string $menuName, integer $depthFrom = 1, integer $depthTo = 1000, string $orderBy = null ) : array
$menuName string eg menu1
$depthFrom integer
$depthTo integer
$orderBy string can be set to 'title' to change ordering
return array