Example #1
0
 /**
  * Adds a menu item to the application submenu
  *
  * @param   Item $item
  *
  * @return  void
  */
 public function addSubmenu(Item $item)
 {
     // Make sure the name begins with "submenu_"
     $name = $item->getName();
     if (strpos($name, 'submenu_') !== 0) {
         $item->setName('submenu_' . $name);
     }
     // Make sure the parent menu item begins with "submenu_"
     $parent = $item->getParent();
     if (!empty($parent) && strpos($parent, 'submenu_') !== 0) {
         $item->setParent('submenu_' . $parent);
     }
     // Set the item to only show in the submenu
     $item->setShow(array('submenu'));
     $this->container->application->getDocument()->getMenu()->addItem($item);
 }