Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

56 linhas
1.4KB

  1. <?php
  2. namespace Lc\SovBundle\Twig;
  3. use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
  4. use Lc\CaracoleBundle\Model\Section\SectionInterface;
  5. use Lc\SovBundle\Model\Site\SiteInterface;
  6. use Lc\SovBundle\Repository\Reminder\ReminderStoreInterface;
  7. use Lc\SovBundle\Solver\Setting\SettingSolver;
  8. use Symfony\Component\Security\Core\Security;
  9. use Twig\Extension\AbstractExtension;
  10. use Twig\TwigFunction;
  11. class StoreTwigExtension extends AbstractExtension
  12. {
  13. protected Security $security;
  14. protected ReminderStoreInterface $reminderStore;
  15. protected SettingSolver $settingSolver;
  16. public function __construct(
  17. Security $security,
  18. ReminderStoreInterface $reminderStore,
  19. SettingSolver $settingSolver
  20. ) {
  21. $this->security = $security;
  22. $this->reminderStore = $reminderStore;
  23. $this->settingSolver = $settingSolver;
  24. }
  25. public function getFunctions()
  26. {
  27. return [
  28. new TwigFunction('sov_reminders', [$this, 'getReminders']),
  29. new TwigFunction('site_setting', [$this, 'getSiteSetting']),
  30. ];
  31. }
  32. public function getFilters()
  33. {
  34. return [];
  35. }
  36. public function getSiteSetting(SiteInterface $site, string $settingName): ?string
  37. {
  38. return $this->settingSolver->getSettingValue($site, $settingName);
  39. }
  40. public function getReminders($params)
  41. {
  42. // @TODO : à faire
  43. return array();
  44. }
  45. }