public function provide($container)
 {
     $instance = $this->instanceManager->getInstanceFromRequest();
     $pages = [];
     try {
         $container = $this->navigationManager->findContainerByNameAndInstance($container, $instance);
     } catch (ContainerNotFoundException $e) {
         return [];
     }
     $key = hash('sha256', serialize($container));
     if ($this->storage->hasItem($key)) {
         return $this->storage->getItem($key);
     }
     foreach ($container->getPages() as $page) {
         $addPage = $this->buildPage($page);
         $hasUri = isset($addPage['uri']);
         $hasMvc = isset($addPage['action']) || isset($addPage['controller']) || isset($addPage['route']);
         $hasProvider = isset($addPage['provider']);
         if ($hasUri || $hasMvc || $hasProvider) {
             $pages[] = $addPage;
         }
     }
     $this->storage->setItem($key, $pages);
     return $pages;
 }
Esempio n. 2
0
 public function __invoke($source)
 {
     try {
         $instance = $this->instanceManager->getInstanceFromRequest();
         return $this->aliasManager->findAliasBySource($source, $instance);
     } catch (Exception $e) {
         return $source;
     }
 }
Esempio n. 3
0
 /**
  * @param InstanceManagerInterface $instanceManager
  * @param TrackingHelperOptions    $options
  */
 public function __construct(InstanceManagerInterface $instanceManager, TrackingHelperOptions $options)
 {
     $this->instanceManager = $instanceManager;
     $instance = $instanceManager->getInstanceFromRequest();
     $name = strtolower($instance->getName());
     $this->options = $options->getInstance($name);
 }
 public function indexAction()
 {
     $instance = $this->instanceManager->getInstanceFromRequest();
     $this->assertGranted('navigation.manage', $instance);
     $containers = $this->navigationManager->findContainersByInstance($instance);
     $view = new ViewModel(['containers' => $containers]);
     $view->setTemplate('navigation/containers');
     return $view;
 }
Esempio n. 5
0
 public function findAll($page, $limit = 100)
 {
     $className = $this->getClassResolver()->resolveClassName('Event\\Entity\\EventLogInterface');
     $instance = $this->instanceManager->getInstanceFromRequest();
     $dql = 'SELECT e FROM ' . $className . ' e ' . ' WHERE e.instance = ' . $instance->getId() . ' ORDER BY e.id DESC';
     $paginator = new DoctrinePaginatorFactory($this->objectManager);
     $paginator = $paginator->createPaginator($dql, $page, $limit);
     $paginator->setFilter($this->persistentEventLogFilterChain);
     return $paginator;
 }
 /**
  * @param object        $object
  * @param FormInterface $form
  * @return object
  * @throws RuntimeException
  */
 protected function bind($object, FormInterface $form)
 {
     $processingForm = clone $form;
     $data = $processingForm->getData(FormInterface::VALUES_AS_ARRAY);
     $processingForm->bind($object);
     $processingForm->setData($data);
     if (!$processingForm->isValid()) {
         throw new RuntimeException(print_r($processingForm->getMessages(), true));
     }
     if ($object instanceof ParameterKeyInterface) {
         $instance = $this->instanceManager->getInstanceFromRequest();
     } else {
         $instance = $object;
     }
     $this->assertGranted('navigation.manage', $instance);
     $this->objectManager->persist($object);
     return $object;
 }
Esempio n. 7
0
 /**
  * {@inheritDoc}
  */
 public function search($query)
 {
     $query = $result = preg_replace('@([\\+\\-\\&\\|\\!\\(\\)\\{\\}\\[\\]\\^\\"\\~\\*\\?\\:])@is', '\\\\1', $query);
     $queryClass = $this->client->createSelect();
     $instance = $this->instanceManager->getInstanceFromRequest();
     $queryClass->createFilterQuery('ínstanceFilter')->setQuery('instance:(' . $instance->getId() . ')');
     $hl = $queryClass->getHighlighting();
     $hl->setFields('content');
     $hl->setSimplePrefix('<strong>');
     $hl->setSimplePostfix('</strong>');
     $queryClass->setFields(['*', 'score']);
     $disMax = $queryClass->getDisMax();
     $disMax->setQueryFields('title^4 content keywords^2 type^3');
     $queryClass->setQuery($query);
     $queryClass->addSort('score', $queryClass::SORT_DESC);
     $queryClass->setQueryDefaultOperator($queryClass::QUERY_OPERATOR_AND);
     $adapter = new SolrPaginator($this->client, $queryClass);
     $adapter->setTranslator($this->translator);
     $paginator = new Paginator($adapter);
     return $paginator;
 }
Esempio n. 8
0
 public function renderSelect()
 {
     $data = ['instances' => $this->instanceManager->findAllInstances(), 'current' => $this->instanceManager->getInstanceFromRequest()];
     return $this->getView()->partial('instance/helper/select', $data);
 }
Esempio n. 9
0
 public function __invoke()
 {
     $currentInstance = $this->instanceManager->getInstanceFromRequest();
     return $currentInstance->getLanguage()->getCode();
 }
Esempio n. 10
0
 /**
  * @param BrandHelperOptions       $brandHelperOptions
  * @param InstanceManagerInterface $instanceManager
  */
 public function __construct(BrandHelperOptions $brandHelperOptions, InstanceManagerInterface $instanceManager)
 {
     $key = $instanceManager->getInstanceFromRequest()->getName();
     $this->instanceManager = $instanceManager;
     $this->options = $brandHelperOptions->getInstance($key);
 }