Skip to content

Commit 00f36bb

Browse files
mpdudexabbuh
authored andcommitted
Twig Extension does no longer need getName() method
This has been deprecated as of Twig 1.26, see https://github.com/twigphp/Twig/blob/v1.26.0/CHANGELOG#L7
1 parent c1a7b45 commit 00f36bb

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

templating/twig_extension.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@ As an example you'll create a price filter to format a given number into price::
4949

5050
return $price;
5151
}
52-
53-
public function getName()
54-
{
55-
return 'app_extension';
56-
}
5752
}
5853

54+
.. note::
55+
56+
  Prior to Twig 1.26, your extension had to provide an additional `getName` method that
57+
returned the extension's internal name. When your extension needs to be compatible
58+
with Twig versions before 1.26, include this method which is omitted in the example
59+
above.
60+
5961
.. tip::
6062

6163
Along with custom filters, you can also add custom `functions`_ and register

0 commit comments

Comments
 (0)