mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-01-15 22:01:23 +00:00
Refactor Twig extensions to use attributes for declaring functions and filters, remove AbstractExtension inheritance, and clean up related service definitions.
This commit is contained in:
@@ -20,28 +20,19 @@ use Twig\Error\SyntaxError;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
|
||||
class Templating extends AbstractExtension
|
||||
class Templating
|
||||
{
|
||||
public function __construct(
|
||||
private readonly RequestStack $requestStack,
|
||||
private readonly FilterOrderGetActiveFilterHelper $filterOrderGetActiveFilterHelper,
|
||||
) {}
|
||||
|
||||
#[\Override]
|
||||
public function getFilters(): array
|
||||
{
|
||||
return [
|
||||
new TwigFilter('chill_render_filter_order_helper', $this->renderFilterOrderHelper(...), [
|
||||
'needs_environment' => true, 'is_safe' => ['html'],
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SyntaxError
|
||||
* @throws RuntimeError
|
||||
* @throws LoaderError
|
||||
*/
|
||||
#[\Twig\Attribute\AsTwigFilter('chill_render_filter_order_helper', needsEnvironment: true, isSafe: ['html'])]
|
||||
public function renderFilterOrderHelper(
|
||||
Environment $environment,
|
||||
FilterOrderHelper $helper,
|
||||
|
||||
Reference in New Issue
Block a user