Skip to content

Commit b838118

Browse files
committed
minor #7523 Twig Extension does no longer need getName() method (mpdude, javiereguiluz)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #7523). Discussion ---------- 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 Commits ------- f94fd8f Fixed a syntax issue 200683e Minor change c59a8d5 Fix .rst formatting 00f36bb Twig Extension does no longer need getName() method
2 parents c1a7b45 + f94fd8f commit b838118

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

templating/twig_extension.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,16 @@ 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 define an additional ``getName()``
57+
method that returned a string with the extension's internal name (e.g.
58+
``app.my_extension``). When your extension needs to be compatible with Twig
59+
versions before 1.26, include this method which is omitted in the example
60+
above.
61+
5962
.. tip::
6063

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

0 commit comments

Comments
 (0)