src/Service/Common/Owner/TwigFunctions.php line 32
<?php
namespace App\Service\Common\Owner;
use App\Model\Common\GetOwnerInterface;
use App\Model\Common\HaveOwnerInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
class TwigFunctions extends AbstractExtension
{
/**
* @var Render
*/
private Render $render;
public function __construct(Render $render)
{
$this->render = $render;
}
public function getFilters(): array
{
return [
new TwigFilter('owner_render', [$this, 'owner_render'], array('is_safe' => array('html'))),
];
}
/**
* @throws \Exception
*/
public function owner_render(GetOwnerInterface $item, string $target, array $context = []): ?string
{
return $this->render->render($item, $target, $context);
}
}