|
1234567891011121314151617181920212223242526272829 |
- <?php
-
- namespace Lc\SovBundle\Twig;
-
- use Lc\SovBundle\Solver\Setting\SettingSolver;
- use Twig\Extension\AbstractExtension;
- use Twig\TwigFunction;
-
- class SettingTwigExtension extends AbstractExtension
- {
- protected SettingSolver $settingSolver;
-
- public function __construct(SettingSolver $settingSolver)
- {
- $this->settingSolver = $settingSolver;
- }
-
- public function getFunctions()
- {
- return array(
- new TwigFunction('sov_setting', [$this, 'getSettingValue']),
- );
- }
-
- public function getSettingValue($entity, $settingName)
- {
- return $this->settingSolver->getSettingValue($entity, $settingName);
- }
- }
|