From 741f655cfc2675c5795a90aabc64f84d8a2fc254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 19 Dec 2025 12:23:20 +0100 Subject: [PATCH] Refactor Twig extensions to use attributes for declaring functions and filters, remove `AbstractExtension` inheritance, and clean up related service definitions. --- .../Twig/CustomFieldRenderingTwig.php | 31 ++++------------ .../Twig/CustomFieldsGroupRenderingTwig.php | 23 ++---------- .../config/services.yaml | 4 -- .../CRUD/Templating/TwigCRUDResolver.php | 24 ++---------- .../Pagination/ChillItemsPerPageTwig.php | 18 +-------- .../Pagination/ChillPaginationTwig.php | 18 +-------- .../ChillMainBundle/Routing/MenuTwig.php | 17 +-------- .../Templating/CSVCellTwig.php | 22 +---------- .../ChillMarkdownRenderExtension.php | 13 +------ .../Templating/ChillTwigHelper.php | 14 +------ .../Templating/ChillTwigRoutingHelper.php | 37 ++----------------- .../ChillTwigRoutingHelperLabel.php | 29 +++++++++++++++ .../Entity/ChillEntityRenderExtension.php | 20 ++-------- .../Templating/Listing/Templating.php | 13 +------ .../Templating/Widget/WidgetRenderingTwig.php | 15 +++----- .../ChillMainBundle/config/services/crud.yaml | 2 - .../config/services/pagination.yaml | 4 -- .../config/services/routing.yaml | 2 - .../config/services/templating.yaml | 10 ++--- 19 files changed, 72 insertions(+), 244 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelperLabel.php diff --git a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php index 73e21afc9..261ca5109 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php +++ b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php @@ -22,7 +22,7 @@ use Twig\TwigFunction; * * chill_custom_field_widget : to render the value of the custom field, * * chill_custom_field_label : to render the label of the custom field,. */ -class CustomFieldRenderingTwig extends AbstractExtension +class CustomFieldRenderingTwig { /** * @var array The default parameters @@ -33,29 +33,6 @@ class CustomFieldRenderingTwig extends AbstractExtension public function __construct(private readonly CustomFieldsHelper $customFieldsHelper) {} - /** - * (non-PHPdoc). - * - * @see Twig_Extension::getFunctions() - */ - #[\Override] - public function getFunctions() - { - return [ - new TwigFunction('chill_custom_field_widget', $this->renderWidget(...), [ - 'is_safe' => [ - 'html', - ], - ]), - new TwigFunction('chill_custom_field_label', $this->renderLabel(...), [ - 'is_safe' => [ - 'html', - ], - 'needs_environment' => true, - ]), - ]; - } - /** (non-PHPdoc). * @see Twig_ExtensionInterface::getName() */ @@ -79,6 +56,9 @@ class CustomFieldRenderingTwig extends AbstractExtension * * @return string HTML representation of the custom field label */ + #[\Twig\Attribute\AsTwigFunction('chill_custom_field_label', isSafe: [ + 'html', + ], needsEnvironment: true)] public function renderLabel(Environment $env, CustomField $customField, array $params = []): string { $resolvedParams = array_merge($this->defaultParams, $params); @@ -97,6 +77,9 @@ class CustomFieldRenderingTwig extends AbstractExtension * * @return string HTML representation of the custom field value, as described in the CustomFieldInterface. Is HTML safe */ + #[\Twig\Attribute\AsTwigFunction('chill_custom_field_widget', isSafe: [ + 'html', + ])] public function renderWidget(array $fields, CustomField $customField, $documentType = 'html') { return $this->customFieldsHelper diff --git a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldsGroupRenderingTwig.php b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldsGroupRenderingTwig.php index f0145ea98..6bb908edf 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldsGroupRenderingTwig.php +++ b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldsGroupRenderingTwig.php @@ -20,7 +20,7 @@ use Twig\TwigFunction; * * chill_custom_fields_group_widget : to render the value of a custom field * * group. */ -final class CustomFieldsGroupRenderingTwig extends AbstractExtension +final class CustomFieldsGroupRenderingTwig { /** * @var array The default parameters @@ -38,24 +38,6 @@ final class CustomFieldsGroupRenderingTwig extends AbstractExtension $this->defaultParams['show_empty'] = $showEmptyValues; } - /** - * (non-PHPdoc). - * - * @see Twig_Extension::getFunctions() - */ - #[\Override] - public function getFunctions() - { - return [ - new TwigFunction('chill_custom_fields_group_widget', $this->renderWidget(...), [ - 'is_safe' => [ - 'html', - ], - 'needs_environment' => true, - ]), - ]; - } - /** (non-PHPdoc). * @see Twig_ExtensionInterface::getName() */ @@ -81,6 +63,9 @@ final class CustomFieldsGroupRenderingTwig extends AbstractExtension * @return string HTML representation of the custom field group value, as described in * the CustomFieldInterface. Is HTML safe */ + #[\Twig\Attribute\AsTwigFunction('chill_custom_fields_group_widget', isSafe: [ + 'html', + ], needsEnvironment: true)] public function renderWidget(Environment $env, array $fields, $customFielsGroup, $documentType = 'html', array $params = []): string { $resolvedParams = array_merge($this->defaultParams, $params); diff --git a/src/Bundle/ChillCustomFieldsBundle/config/services.yaml b/src/Bundle/ChillCustomFieldsBundle/config/services.yaml index 454fd0120..78c22810a 100644 --- a/src/Bundle/ChillCustomFieldsBundle/config/services.yaml +++ b/src/Bundle/ChillCustomFieldsBundle/config/services.yaml @@ -102,15 +102,11 @@ services: class: Chill\CustomFieldsBundle\Templating\Twig\CustomFieldRenderingTwig arguments: - "@chill.custom_field.helper" - tags: - - { name: twig.extension } chill.custom_field.twig.custom_fields_group_rendering: class: Chill\CustomFieldsBundle\Templating\Twig\CustomFieldsGroupRenderingTwig arguments: - "%chill_custom_fields.show_empty_values%" - tags: - - { name: twig.extension } chill.custom_field.custom_field_long_choice: class: Chill\CustomFieldsBundle\CustomFields\CustomFieldLongChoice diff --git a/src/Bundle/ChillMainBundle/CRUD/Templating/TwigCRUDResolver.php b/src/Bundle/ChillMainBundle/CRUD/Templating/TwigCRUDResolver.php index 0798bd268..7b6141a9d 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Templating/TwigCRUDResolver.php +++ b/src/Bundle/ChillMainBundle/CRUD/Templating/TwigCRUDResolver.php @@ -19,7 +19,7 @@ use Twig\TwigFunction; * Class TwigCRUDResolver * Twig filters to display data in crud template. */ -class TwigCRUDResolver extends AbstractExtension +class TwigCRUDResolver { /** * @var Resolver @@ -39,31 +39,13 @@ class TwigCRUDResolver extends AbstractExtension * * @return string */ + #[\Twig\Attribute\AsTwigFunction('chill_crud_config', isSafe: ['html'])] public function getConfig($configKey, $crudName, $action = null) { return $this->resolver->getConfigValue($configKey, $crudName, $action); } - /** - * @return array|TwigFunction[] - */ - #[\Override] - public function getFunctions() - { - return [ - new TwigFunction( - 'chill_crud_config', - $this->getConfig(...), - ['is_safe' => 'html'] - ), - new TwigFunction( - 'chill_crud_action_exists', - $this->hasAction(...), - [] - ), - ]; - } - + #[\Twig\Attribute\AsTwigFunction('chill_crud_action_exists')] public function hasAction($crudName, $action): bool { return $this->resolver->hasAction($crudName, $action); diff --git a/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php b/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php index 36bf1b3ce..794430427 100644 --- a/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php +++ b/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php @@ -18,28 +18,14 @@ use Twig\TwigFunction; /** * add twig function to render pagination. */ -class ChillItemsPerPageTwig extends AbstractExtension +class ChillItemsPerPageTwig { - #[\Override] - public function getFunctions() - { - return [ - new TwigFunction( - 'chill_items_per_page', - $this->paginationRender(...), - [ - 'needs_environment' => true, - 'is_safe' => ['html'], - ] - ), - ]; - } - public function getName() { return 'chill_items_per_page'; } + #[\Twig\Attribute\AsTwigFunction('chill_items_per_page', needsEnvironment: true, isSafe: ['html'])] public function paginationRender( Environment $env, PaginatorInterface $paginator, diff --git a/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php b/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php index c5950c770..ec9856a71 100644 --- a/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php +++ b/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php @@ -18,32 +18,18 @@ use Twig\TwigFunction; /** * add twig function to render pagination. */ -class ChillPaginationTwig extends AbstractExtension +class ChillPaginationTwig { final public const string LONG_TEMPLATE = '@ChillMain/Pagination/long.html.twig'; final public const string SHORT_TEMPLATE = '@ChillMain/Pagination/short.html.twig'; - #[\Override] - public function getFunctions() - { - return [ - new TwigFunction( - 'chill_pagination', - $this->paginationRender(...), - [ - 'needs_environment' => true, - 'is_safe' => ['html'], - ] - ), - ]; - } - public function getName() { return 'chill_pagination'; } + #[\Twig\Attribute\AsTwigFunction('chill_pagination', needsEnvironment: true, isSafe: ['html'])] public function paginationRender( Environment $env, PaginatorInterface $paginator, diff --git a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php index e49682ddb..96b0c7631 100644 --- a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php +++ b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php @@ -18,7 +18,7 @@ use Twig\TwigFunction; /** * Add the filter 'chill_menu'. */ -class MenuTwig extends AbstractExtension +class MenuTwig { /** * the default parameters for chillMenu. @@ -45,6 +45,7 @@ class MenuTwig extends AbstractExtension * @param mixed[] $params */ #[\Deprecated(message: 'link: see https://redmine.champs-libres.coop/issues/179 for more informations')] + #[\Twig\Attribute\AsTwigFunction('chill_menu', isSafe: ['html'], needsEnvironment: true)] public function chillMenu(Environment $env, $menuId, array $params = []): string { $resolvedParams = array_merge($this->defaultParams, $params); @@ -62,20 +63,6 @@ class MenuTwig extends AbstractExtension return $env->render($layout, $resolvedParams); } - #[\Override] - public function getFunctions() - { - return [new TwigFunction( - 'chill_menu', - $this->chillMenu(...), - [ - 'is_safe' => ['html'], - 'needs_environment' => true, - ] - ), - ]; - } - public function getName() { return 'chill_menu'; diff --git a/src/Bundle/ChillMainBundle/Templating/CSVCellTwig.php b/src/Bundle/ChillMainBundle/Templating/CSVCellTwig.php index 892a4a3ca..f6d3486f7 100644 --- a/src/Bundle/ChillMainBundle/Templating/CSVCellTwig.php +++ b/src/Bundle/ChillMainBundle/Templating/CSVCellTwig.php @@ -20,7 +20,7 @@ use Twig\TwigFilter; * * This filter replace the char " by "" */ -class CSVCellTwig extends AbstractExtension +class CSVCellTwig { /** * Replace into a string the char " by "". @@ -29,30 +29,12 @@ class CSVCellTwig extends AbstractExtension * * @return string the safe string */ + #[\Twig\Attribute\AsTwigFilter('csv_cell', isSafe: ['html'])] public function csvCellFilter($content): string|array { return str_replace('"', '""', $content); } - /** - * Returns a list of filters to add to the existing list. - * - * (non-PHPdoc) - * - * @see Twig_Extension::getFilters() - */ - #[\Override] - public function getFilters() - { - return [ - new TwigFilter( - 'csv_cell', - $this->csvCellFilter(...), - ['is_safe' => ['html']] - ), - ]; - } - /** * Returns the name of the extension. * diff --git a/src/Bundle/ChillMainBundle/Templating/ChillMarkdownRenderExtension.php b/src/Bundle/ChillMainBundle/Templating/ChillMarkdownRenderExtension.php index 39931b4ed..b91fea18b 100644 --- a/src/Bundle/ChillMainBundle/Templating/ChillMarkdownRenderExtension.php +++ b/src/Bundle/ChillMainBundle/Templating/ChillMarkdownRenderExtension.php @@ -17,7 +17,7 @@ use Twig\TwigFilter; /** * Render markdown. */ -final class ChillMarkdownRenderExtension extends AbstractExtension +final class ChillMarkdownRenderExtension { /** * @var \Parsedown @@ -30,16 +30,7 @@ final class ChillMarkdownRenderExtension extends AbstractExtension $this->parsedown->setSafeMode(true); } - #[\Override] - public function getFilters(): array - { - return [ - new TwigFilter('chill_markdown_to_html', $this->renderMarkdownToHtml(...), [ - 'is_safe' => ['html'], - ]), - ]; - } - + #[\Twig\Attribute\AsTwigFilter('chill_markdown_to_html', isSafe: ['html'])] public function renderMarkdownToHtml(?string $var): string { return $this->parsedown->parse((string) $var); diff --git a/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php b/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php index 2b61660fb..600b8d1d8 100644 --- a/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php @@ -16,19 +16,8 @@ use Twig\Environment; use Twig\Extension\AbstractExtension; use Twig\TwigFilter; -class ChillTwigHelper extends AbstractExtension +class ChillTwigHelper { - #[\Override] - public function getFilters() - { - return [ - new TwigFilter('chill_print_or_message', $this->printOrMessage(...), [ - 'needs_environment' => true, - 'is_safe' => ['html', 'html_attrs'], - ]), - ]; - } - /** * Print `value` inside a template, or, if $value is empty, * print $message. @@ -49,6 +38,7 @@ class ChillTwigHelper extends AbstractExtension * @param string $message * @param string $template */ + #[\Twig\Attribute\AsTwigFilter('chill_print_or_message', needsEnvironment: true, isSafe: ['html', 'html_attrs'])] public function printOrMessage( Environment $twig, $value, diff --git a/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php b/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php index ae0d71a4d..1d59ed6d6 100644 --- a/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php @@ -13,9 +13,7 @@ namespace Chill\MainBundle\Templating; use Symfony\Bridge\Twig\Extension\RoutingExtension; use Symfony\Component\HttpFoundation\RequestStack; -use Twig\Extension\AbstractExtension; use Twig\Node\Node; -use Twig\TwigFilter; use Twig\TwigFunction; /** @@ -23,25 +21,12 @@ use Twig\TwigFunction; * * The logic of the function is based on the original routing extension. */ -class ChillTwigRoutingHelper extends AbstractExtension +final readonly class ChillTwigRoutingHelper { - /** - * @var RoutingExtension - */ - protected $originalExtension; - - /** - * @var RequestStack - */ - protected $requestStack; - public function __construct( - RequestStack $requestStack, - RoutingExtension $originalExtension, - ) { - $this->requestStack = $requestStack; - $this->originalExtension = $originalExtension; - } + private RequestStack $requestStack, + private RoutingExtension $originalExtension, + ) {} public function getFunctions(): array { @@ -75,20 +60,6 @@ class ChillTwigRoutingHelper extends AbstractExtension return $this->originalExtension->getPath($name, $params, $relative); } - public function getFilters(): array - { - return [ - new TwigFilter('chill_return_path_label', $this->getLabelReturnPath(...)), - ]; - } - - public function getLabelReturnPath($default) - { - $request = $this->requestStack->getCurrentRequest(); - - return $request->query->get('returnPathLabel', null) ?? $default; - } - /** * Build an url with a returnPath parameter to current page. * diff --git a/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelperLabel.php b/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelperLabel.php new file mode 100644 index 000000000..d97d1e8a7 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelperLabel.php @@ -0,0 +1,29 @@ +requestStack->getCurrentRequest(); + + return $request->query->get('returnPathLabel', null) ?? $default; + } +} diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php index aad3ed6a2..92b04e8ef 100644 --- a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php +++ b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php @@ -17,31 +17,17 @@ use Twig\TwigFilter; /** * Class ChillEntityRenderExtension. */ -class ChillEntityRenderExtension extends AbstractExtension +class ChillEntityRenderExtension { public function __construct(private readonly ChillEntityRenderManagerInterface $renderManager) {} - /** - * @return array|TwigFilter[] - */ - #[\Override] - public function getFilters() - { - return [ - new TwigFilter('chill_entity_render_string', $this->renderString(...), [ - 'is_safe' => ['html'], - ]), - new TwigFilter('chill_entity_render_box', $this->renderBox(...), [ - 'is_safe' => ['html'], - ]), - ]; - } - + #[\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); diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php b/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php index 4d34f587b..8b192e762 100644 --- a/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php +++ b/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php @@ -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, diff --git a/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php b/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php index 5ed936632..ac5581a6b 100644 --- a/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php +++ b/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php @@ -13,8 +13,8 @@ namespace Chill\MainBundle\Templating\Widget; use Chill\MainBundle\Templating\Events\DelegatedBlockRenderingEvent; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Twig\DeprecatedCallableInfo; use Twig\Environment; -use Twig\Extension\AbstractExtension; use Twig\TwigFunction; /** @@ -40,7 +40,7 @@ use Twig\TwigFunction; * `Chill\MainBundle\Templating\Events\DelegatedBlockRenderingEvent` * for usage of this event class */ -class WidgetRenderingTwig extends AbstractExtension +class WidgetRenderingTwig { /** * @var EventDispatcherInterface @@ -83,8 +83,7 @@ class WidgetRenderingTwig extends AbstractExtension $this->widget[$place][$ordering] = [$widget, $config]; } - #[\Override] - public function getFunctions() + public function getFunctions(): array { return [ new TwigFunction( @@ -96,11 +95,6 @@ class WidgetRenderingTwig extends AbstractExtension 'deprecated' => true, 'alternative' => 'chill_widget', ] ), - new TwigFunction( - 'chill_widget', - $this->renderingWidget(...), - ['is_safe' => ['html'], 'needs_environment' => true] - ), ]; } @@ -109,7 +103,8 @@ class WidgetRenderingTwig extends AbstractExtension return 'chill_main_widget'; } - public function renderingWidget(Environment $env, $block, array $context = []) + #[\Twig\Attribute\AsTwigFunction('chill_widget', needsEnvironment: true, isSafe: ['html'], deprecationInfo: new DeprecatedCallableInfo('chill-project/chill-bundles', '3.0'))] + public function renderingWidget(Environment $env, $block, array $context = []): string { // get the content of widgets $content = ''; diff --git a/src/Bundle/ChillMainBundle/config/services/crud.yaml b/src/Bundle/ChillMainBundle/config/services/crud.yaml index 02533f433..372dddb37 100644 --- a/src/Bundle/ChillMainBundle/config/services/crud.yaml +++ b/src/Bundle/ChillMainBundle/config/services/crud.yaml @@ -17,5 +17,3 @@ services: Chill\MainBundle\CRUD\Templating\TwigCRUDResolver: arguments: $resolver: '@Chill\MainBundle\CRUD\Resolver\Resolver' - tags: - - { name: twig.extension } diff --git a/src/Bundle/ChillMainBundle/config/services/pagination.yaml b/src/Bundle/ChillMainBundle/config/services/pagination.yaml index bdcef3a10..d1417d0ad 100644 --- a/src/Bundle/ChillMainBundle/config/services/pagination.yaml +++ b/src/Bundle/ChillMainBundle/config/services/pagination.yaml @@ -16,10 +16,6 @@ services: chill_main.paginator.twig_extensions: class: Chill\MainBundle\Pagination\ChillPaginationTwig - tags: - - { name: twig.extension } chill_main.paginator.items_per_page.twig_extensions: class: Chill\MainBundle\Pagination\ChillItemsPerPageTwig - tags: - - { name: twig.extension } diff --git a/src/Bundle/ChillMainBundle/config/services/routing.yaml b/src/Bundle/ChillMainBundle/config/services/routing.yaml index 7d5a80358..80cb07f90 100644 --- a/src/Bundle/ChillMainBundle/config/services/routing.yaml +++ b/src/Bundle/ChillMainBundle/config/services/routing.yaml @@ -20,8 +20,6 @@ services: chill.main.twig.chill_menu: class: Chill\MainBundle\Routing\MenuTwig - tags: - - { name: twig.extension } Chill\MainBundle\Routing\ChillUrlGenerator: ~ diff --git a/src/Bundle/ChillMainBundle/config/services/templating.yaml b/src/Bundle/ChillMainBundle/config/services/templating.yaml index 1e73771a5..82da0db35 100644 --- a/src/Bundle/ChillMainBundle/config/services/templating.yaml +++ b/src/Bundle/ChillMainBundle/config/services/templating.yaml @@ -20,17 +20,13 @@ services: # tags: # - { name: twig.extension } - Chill\MainBundle\Templating\ChillTwigHelper: - tags: - - { name: twig.extension } + Chill\MainBundle\Templating\ChillTwigHelper: ~ Chill\MainBundle\Templating\ChillTwigRoutingHelper: arguments: $originalExtension: '@twig.extension.routing' - autoconfigure: true - autowire: true - tags: - - { name: twig.extension } + + Chill\MainBundle\Templating\ChillTwigRoutingHelperLabel: ~ Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension: autoconfigure: true