/**
  * {@inheritdoc}
  */
 public function isEmpty()
 {
     $this->load();
     return parent::isEmpty();
 }
Exemplo n.º 2
0
 /**
  * Create the root item and items collection and assign to the template.
  *
  * @param MenuModel $menu
  * @param string    $rootType
  * @param string    $rootName
  */
 protected function createItems(MenuModel $menu, $rootType, $rootName)
 {
     $providerFactory = new ProviderFactory();
     // create local event dispatcher and provider
     $eventDispatcher = $this->createLocalEventDispatcher($menu, $providerFactory);
     // create the event driven menu
     $eventDrivenItemFactory = new EventDrivenItemFactory($eventDispatcher, XNavigationEvents::CREATE_ITEM, XNavigationEvents::COLLECT_ITEMS);
     // create the root item
     $item = $eventDrivenItemFactory->createItem($rootType, $rootName);
     // create the items collection
     if ($menu->include_root) {
         $collection = new ItemCollection();
         $collection->add($item);
     } else {
         $collection = $item->getChildren();
     }
     $this->Template->item = $item;
     $this->Template->items = $collection;
 }