Example #1
0
 protected function getPages(ContainerInterface $serviceLocator)
 {
     if ($this->pages === null) {
         if (!isset($this->configNavigation)) {
             throw new Exception\InvalidArgumentException('Could not find navigation configuration key');
         }
         if (!isset($this->configNavigation[$this->getName()])) {
             throw new Exception\InvalidArgumentException(sprintf('Failed to find a navigation container by the name "%s"', $this->getName()));
         }
         $info = array(array('controller' => 'Index', 'action' => 'general', 'rootslug' => CoreSlugs::Root, 'requireslogin' => true));
         foreach ($info as $details) {
             $controller = $details['controller'];
             $action = $details['action'];
             $rootslug = $details['rootslug'];
             $requireslogin = $details['requireslogin'];
             $cats = $this->wpRepo->fetchChildCategories($rootslug);
             if ($cats == null) {
                 continue;
             }
             foreach ($cats as $rec) {
                 $id = $rec->getSlug() . ".{$controller}.{$action}";
                 $this->configNavigation[$this->getName()][$id] = array('id' => $id, 'label' => $rec->getName(), 'controller' => $controller, 'action' => $action, 'requireslogin' => $requireslogin, 'params' => array('p1' => $rec->getSlug()));
                 $subCats = $this->wpRepo->fetchChildCategories($rec->getSlug());
                 foreach ($subCats as $subRec) {
                     $subId = $subRec->getSlug() . ".{$id}";
                     $this->configNavigation[$this->getName()][$id]['pages'][$subId] = array('id' => $subId, 'label' => $subRec->getName(), 'controller' => $controller, 'action' => $action, 'requireslogin' => $requireslogin, 'params' => array('p1' => $rec->getSlug(), 'p2' => $subRec->getSlug()));
                 }
             }
         }
         $pages = $this->getPagesFromConfig($this->configNavigation[$this->getName()]);
         $this->pages = $this->preparePages($serviceLocator, $pages);
     }
     return $this->pages;
 }
Example #2
0
 public function previewAction()
 {
     $this->navService->findOneById(Navigation::Preview)->setVisible(true);
     $theLoop = $this->wpRepo->fetchTheLoop($this->getRequest()->getQuery()->toString());
     return array('posts' => $theLoop);
 }