本文整理汇总了PHP中MenuItem::add方法的典型用法代码示例。如果您正苦于以下问题:PHP MenuItem::add方法的具体用法?PHP MenuItem::add怎么用?PHP MenuItem::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItem
的用法示例。
在下文中一共展示了MenuItem::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildFromList
/**
* Build the menus.
*
* @param array $menus_list The list of menu information
* @param integer $parent The parent id to build.
*
* @return array
*/
protected function buildFromList($menus_list, $parent = 0)
{
$menus = array();
foreach ($menus_list as $menu) {
//Process only if the menu was not already processed
//and it belongs to the parent id we are building.
if (!$this->isProcessed($menu) && $menu['parent_id'] == $parent) {
//First get the submenus
$children = $this->buildFromList($menus_list, $menu['id']);
$item = new MenuItem($menu['name'], $menu['url']);
foreach ($children as $child) {
$item->add($child);
}
$menus[] = $item;
//Update the status of the current item.
$this->setProcessed($menu);
}
}
return $menus;
}
示例2: v1_6_0
/**
* v1.6.0 : Add the menu item 'user.login'
*/
public function v1_6_0()
{
MenuItem::add(array('plugin' => 'main', 'name' => 'login', 'labelKey' => 'main.login-menu-title', 'icon' => 'sign-in', 'action' => 'login', 'target' => 'dialog'));
}