You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.2KB

  1. <?php
  2. namespace App\Twig;
  3. use App\Entity\Page;
  4. use Lc\SovBundle\Manager\EntityManager;
  5. use Twig\Extension\AbstractExtension;
  6. use Twig\TwigFilter;
  7. use Twig\TwigFunction;
  8. /**
  9. *
  10. *
  11. * @author Fab
  12. */
  13. class TwigExtension extends AbstractExtension
  14. {
  15. private $container;
  16. private $vichHelper;
  17. private $liipCacheHelper;
  18. private $requestStack = false;
  19. private $em;
  20. private $mwCache;
  21. public function __construct(EntityManager $em)
  22. {
  23. $this->em = $em;
  24. }
  25. public function getFilters()
  26. {
  27. return array(
  28. );
  29. }
  30. public function getFunctions()
  31. {
  32. return array(
  33. new TwigFunction('getPagesNav', array($this, 'getPagesNav'))
  34. );
  35. }
  36. public function getPagesNav()
  37. {
  38. $pageRepository = $this->em->getRepository(Page::class);
  39. //return $pageRepository->findByShowInMenu(1, array('position' => 'asc'));
  40. return $pageRepository->findBy(array(), array('position' => 'asc'));
  41. }
  42. }