Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

56 lines
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. }