Exemplo n.º 1
0
 /**
  * @param FieldableEntity|Node $entity
  * @param array                $options
  *
  * @return array
  */
 public function getTemplateOptions($entity, array $options)
 {
     if (!$entity) {
         return [];
     }
     $route = $entity->getRoute();
     $url = $this->router->generate($route->getName(), []);
     return ['url' => $url, 'text' => $entity->getTitle(), 'new_tab' => $options['new_tab'], 'follow' => $options['follow']];
 }
Exemplo n.º 2
0
 /**
  * @param FieldableEntity|Tag $entity
  * @param array $options
  * @return array
  */
 public function getTemplateOptions(FieldableEntity $entity, array $options = [])
 {
     foreach ($options['node_types'] as $nodeClass => $nodeField) {
         $listHandler = new TagListHandler($nodeClass);
         $listHandler->setField($nodeField);
         $listHandler->setTag($entity->getName());
         $listHandler->setPageSize($options['page_size']);
         $listHandler->setTitle($entity->getName());
     }
     $queryBuilder = new QueryBuilder($this->entityManager);
     $listHandler->buildQuery($queryBuilder);
     $nodes = $queryBuilder->getQuery()->execute();
     return ['tag' => $entity->getName(), 'nodes' => $nodes];
 }