File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1556,7 +1556,7 @@ as currency:
1556
1556
.. _templates-twig-filter-attribute :
1557
1557
1558
1558
Create a class with a method that contains the filter logic, then add
1559
- the `#[AsTwigFilter] ` attribute to define the name and options of
1559
+ the `` #[AsTwigFilter] ` ` attribute to define the name and options of
1560
1560
the Twig filter::
1561
1561
1562
1562
// src/Twig/AppExtension.php
@@ -1603,9 +1603,13 @@ If you want to create a function instead of a filter, use the
1603
1603
.. versionadded :: 7.3
1604
1604
1605
1605
Support for the ``#[AsTwigFilter] `` and ``#[AsTwigFunction] `` attributes was introduced in Symfony 7.3.
1606
- Previously, you had to extend the `AbstractExtension ` class, and override the
1606
+ Previously, you had to extend the `` AbstractExtension `` class, and override the
1607
1607
``getFilters() `` and ``getFunctions() `` methods.
1608
1608
1609
+ When using autoconfiguration, the tag ``twig.attribute_extension `` is added automatically
1610
+ when a Twig attribute is used on a method of a class. Otherwise, when autoconfiguration is not enabled,
1611
+ it needs to be added in the service definition.
1612
+
1609
1613
Register an Extension as a Service
1610
1614
..................................
1611
1615
You can’t perform that action at this time.
0 commit comments