Exemplo n.º 1
0
 /**
  * Extracts the children elements of $parent from a $deck of menu items
  *
  * @param   array $deck   The deck of items to search for children
  * @param   Item  $parent The parent element
  */
 private function extractChildren(array &$deck, Item &$parent)
 {
     $children = array();
     if (empty($deck)) {
         return;
     }
     /** @var   Item $item */
     foreach ($deck as $key => $item) {
         if ($item->getParent() == $parent->getName()) {
             $children[] = $item;
             unset($deck[$key]);
         }
     }
     if (!empty($children)) {
         uasort($children, array($this, 'compareItemOrder'));
     }
     $this->addChildrenToParent($parent, $children, $deck);
 }
Exemplo n.º 2
0
 /**
  * Remove a submenu item
  *
  * @param   Item $item The submenu item to remove
  *
  * @return  void
  */
 public function removeSubmenu(Item $item)
 {
     $this->removeSubmenuByName($item->getName());
 }
Exemplo n.º 3
0
 /**
  * Remove a child menu item
  *
  * @param   Item $item
  *
  * @return  void
  */
 public function removeChild(Item $item)
 {
     $key = $item->getName();
     if (!array_key_exists($key, $this->children)) {
         return;
     }
     unset($this->children[$key]);
 }