50 regels
1.4 KiB
PHP
50 regels
1.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*
|
|
* https://www.d3data.de
|
|
*
|
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
|
* @link https://www.oxidmodule.com
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace D3\OxidTwigExtensions;
|
|
|
|
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
|
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
|
|
use Psr\Container\ContainerExceptionInterface;
|
|
use Psr\Container\NotFoundExceptionInterface;
|
|
use Twig\Extension\AbstractExtension;
|
|
use Twig\TwigFunction;
|
|
|
|
class ModuleSettingsServiceExtension extends AbstractExtension
|
|
{
|
|
/**
|
|
* @return TwigFunction[]
|
|
*/
|
|
public function getFunctions(): array
|
|
{
|
|
return [
|
|
new TwigFunction(
|
|
'getModuleSettingsService',
|
|
[$this, 'getModuleSettingsService'],
|
|
['is_safe' => ['html']]
|
|
)
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return ModuleSettingServiceInterface
|
|
* @throws ContainerExceptionInterface
|
|
* @throws NotFoundExceptionInterface
|
|
*/
|
|
public function getModuleSettingsService(): ModuleSettingServiceInterface
|
|
{
|
|
return ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
|
|
}
|
|
} |