/**
  * Inject components into the pages.
  *
  * @internal
  *      Parses the pages options for the "active_on" property and
  *      sets the active flag if one of the routes match.
  *
  * {@inheritDoc}
  *
  */
 protected function injectComponents(array $pages, $routeMatch = null, $router = null, $request = null)
 {
     /* @var RouteMatch|MvcRouter\RouteMatch $routeMatch */
     $routeName = $routeMatch->getMatchedRouteName();
     foreach ($pages as &$page) {
         if (isset($page['active_on']) && in_array($routeName, (array) $page['active_on'])) {
             $page['active'] = true;
         }
     }
     return parent::injectComponents($pages, $routeMatch, $router, $request);
 }
Esempio n. 2
0
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $pages = parent::createService($serviceLocator);
     if ($serviceLocator->has(\SporkTools\Core\Job\ServiceFactory::SERVICE)) {
         $jobManager = $serviceLocator->get(\SporkTools\Core\Job\ServiceFactory::SERVICE);
         if ($jobManager->hasFeature(FeatureInterface::ENABLED)) {
             $page = $pages->findOneBy('route', 'spork-tools/job');
             if (null !== $page) {
                 $page->setVisible(true);
             }
         }
     }
     return $pages;
 }
Esempio n. 3
0
 protected function getPages(\Zend\ServiceManager\ServiceLocatorInterface $serviceLocator)
 {
     return parent::getPages($serviceLocator);
 }