Files
chill-bundles/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php

36 lines
987 B
PHP

<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\Templating\Entity;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
/**
* Class ChillEntityRenderExtension.
*/
class ChillEntityRenderExtension
{
public function __construct(private readonly ChillEntityRenderManagerInterface $renderManager) {}
#[\Twig\Attribute\AsTwigFilter('chill_entity_render_box', isSafe: ['html'])]
public function renderBox(?object $entity, array $options = []): string
{
return $this->renderManager->renderBox($entity, $options);
}
#[\Twig\Attribute\AsTwigFilter('chill_entity_render_string', isSafe: ['html'])]
public function renderString(?object $entity, array $options = []): string
{
return $this->renderManager->renderString($entity, $options);
}
}