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.

30 satır
676B

  1. <?php
  2. namespace Lc\SovBundle\Twig;
  3. use Lc\SovBundle\Solver\Setting\SettingSolver;
  4. use Twig\Extension\AbstractExtension;
  5. use Twig\TwigFunction;
  6. class SettingTwigExtension extends AbstractExtension
  7. {
  8. protected SettingSolver $settingSolver;
  9. public function __construct(SettingSolver $settingSolver)
  10. {
  11. $this->settingSolver = $settingSolver;
  12. }
  13. public function getFunctions()
  14. {
  15. return array(
  16. new TwigFunction('sov_setting', [$this, 'getSettingValue']),
  17. );
  18. }
  19. public function getSettingValue($entity, $settingName)
  20. {
  21. return $this->settingSolver->getSettingValue($entity, $settingName);
  22. }
  23. }