Exemplo n.º 1
0
 /**
  * @param PageHelper            $pageHelper
  * @param UrlGeneratorInterface $generator
  * @param LocaleResolver        $localeResolver
  * @param RequestStack          $requestStack
  * @param LoggerInterface       $logger
  * @param EntityRepository      $errorPageRepository
  * @param                       $locale
  */
 public function __construct(PageHelper $pageHelper, UrlGeneratorInterface $generator, LocaleResolver $localeResolver, RequestStack $requestStack, LoggerInterface $logger, EntityRepository $errorPageRepository, $locale)
 {
     $this->pageHelper = $pageHelper;
     $this->generator = $generator;
     $this->localeResolver = $localeResolver;
     $this->request = $requestStack->getCurrentRequest();
     $this->logger = $logger;
     $this->errorPageRepository = $errorPageRepository;
     parent::__construct($generator);
     $this->locale = $locale;
 }
 public function nav_locale($name, $locale)
 {
     $contentsNav = $this->container->get('session')->has($name . $locale) ? $this->container->get('session')->get($name . $locale) : $this->container->get('doctrine')->getRepository('AppBundle:Nav')->findOneBy(['name' => $name, 'locale' => $locale]);
     if ($contentsNav) {
         $data = $contentsNav->getContentsNav();
         $result = "<ul class='nav navbar-nav'>";
         foreach ($data as $item) {
             if ($item->getType() == 'category') {
                 $route = $this->routingExtenxion->getPath('app_blog_category', ['slug' => $item->getSlug()]);
                 $result .= "<li><a href='" . $route . "'>" . $item->getName() . '</a></li>';
             }
             if ($item->getType() == 'page') {
                 $route = $this->routingExtenxion->getPath('app_page', ['slug' => $item->getSlug()]);
                 $result .= "<li><a href='" . $route . "'>" . $item->getName() . '</a></li>';
             }
         }
         $result .= '</ul>';
         if (!$this->container->get('session')->has($name . $locale)) {
             $this->container->get('session')->set($name . $locale, $contentsNav);
         }
         return $result;
     }
 }
Exemplo n.º 3
0
 public function getFunctions()
 {
     $fn = parent::getFunctions();
     $fn[] = new \Twig_SimpleFunction('path_safe', array($this, 'getPathSafe'));
     return $fn;
 }
 /**
  * @param UrlGeneratorInterface       $generator
  * @param CurrentSiteIdInterface      $siteManager
  * @param ReadNodeRepositoryInterface $nodeRepository
  */
 public function __construct(UrlGeneratorInterface $generator, CurrentSiteIdInterface $siteManager, ReadNodeRepositoryInterface $nodeRepository)
 {
     parent::__construct($generator);
     $this->siteManager = $siteManager;
     $this->nodeRepository = $nodeRepository;
 }
Exemplo n.º 5
0
 public function __construct(PageHelper $pageHelper, UrlGeneratorInterface $generator)
 {
     $this->pageHelper = $pageHelper;
     $this->generator = $generator;
     parent::__construct($generator);
 }