Exemplo n.º 1
0
 /**
  * @param ServiceLocatorInterface $serviceLocator
  *
  * @return \Zend\Navigation\Navigation
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $this->rcmUserService = $serviceLocator->get('RcmUser\\Service\\RcmUserService');
     $this->cmsPermissionChecks = $serviceLocator->get('Rcm\\Acl\\CmsPermissionsChecks');
     $this->currentSite = $serviceLocator->get('Rcm\\Service\\CurrentSite');
     $config = $serviceLocator->get('config');
     /** @var \Doctrine\ORM\EntityManagerInterface $entityManager */
     $entityManager = $serviceLocator->get('Doctrine\\ORM\\EntityManager');
     /** @var \Rcm\Repository\Page $pageRepo */
     $this->pageRepo = $entityManager->getRepository('\\Rcm\\Entity\\Page');
     $application = $serviceLocator->get('Application');
     /** @var RouteMatch $routeMatch */
     $routeMatch = $application->getMvcEvent()->getRouteMatch();
     if (!in_array($routeMatch->getMatchedRouteName(), $config['Rcm']['RcmCmsPageRouteNames'])) {
         return parent::createService($serviceLocator);
     }
     $pageMatch = $routeMatch->getParam('page', 'index');
     if ($pageMatch instanceof Page) {
         $pageMatch = $pageMatch->getName();
     }
     $this->pageRevision = $routeMatch->getParam('revision', null);
     $pageTypeMatch = $routeMatch->getParam('pageType', 'n');
     if (!empty($pageMatch)) {
         $this->page = $this->pageRepo->findOneBy(['name' => $pageMatch, 'pageType' => $pageTypeMatch]);
     }
     return parent::createService($serviceLocator);
 }
 protected function getPages(ServiceLocatorInterface $serviceLocator)
 {
     if (null === $this->pages) {
         $pages = parent::getPages($serviceLocator);
         /** @var Configuration $configuration */
         $configuration = $serviceLocator->get('EnliteAdminConfiguration');
         if ($configuration->getEnableNavigation()) {
             $this->pages = ArrayUtils::merge($pages, $this->getEntitiesPage($serviceLocator));
         }
     }
     return $this->pages;
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 protected function getPagesFromConfig($config = null)
 {
     $result = parent::getPagesFromConfig($config);
     $activeSite = $this->utilityService->getSiteId();
     $sites = $this->siteService->findAll();
     $sitePages = array();
     foreach ($sites as $site) {
         $isActive = $site->getId() === $activeSite;
         if ($isActive) {
             $result[0]['label'] = $site->getEnglishName();
         }
         $sitePages[] = array('label' => $site->getEnglishName(), 'route' => 'select-site', 'active' => $isActive, 'query' => array('siteId' => $site->getId()));
     }
     $result[0]['pages'] = $sitePages;
     return $result;
 }