Exemple #1
0
 /**
  * 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;
 }
Exemple #2
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'));
 }