Lines Matching refs:extension

18     share them with others, you should then create an extension as described
26 or package your code into an extension (see the next section of this
30 different possible extension points and when to use them.
38 To understand why Twig exposes so many extension points, let's see how to
60 the most complex extension point of Twig.
80 extension point to use. And you can use it anywhere an expression is accepted:
220 In an extension, you can also define a filter as a static method of the
221 extension class.
319 You can also expose extension methods as functions in your templates::
381 The ``set`` tag is part of the Core extension and as such is always
511 The main motivation for writing an extension is to move often used code into a
512 reusable class like adding support for internationalization. An extension can
516 Creating an extension also makes for a better separation of code that is
520 Most of the time, it is useful to create a single extension for your project,
525 When packaging your code into an extension, Twig is smart enough to
532 extension repository: https://github.com/twigphp/Twig-extensions.
534 An extension is a class that implements the following interface::
595 * Returns the name of the extension.
597 * @return string The extension name
602 To keep your extension class clean and lean, it can inherit from the built-in
607 The ``getName()`` method must return a unique identifier for your extension.
609 Now, with this information in mind, let's create the most basic extension
622 Of course, this extension does nothing for now. We will customize it in
625 Twig does not care where you save your extension on the filesystem, as all
628 You can register an extension by using the ``addExtension()`` method on your
634 Of course, you need to first load the extension file by either using
644 Global variables can be registered in an extension via the ``getGlobals()``
662 Functions can be registered in an extension via the ``getFunctions()``
680 To add a filter to an extension, you need to override the ``getFilters()``
701 on the extension class::
726 ``$this``, the current extension object. The second one is the name of the
737 them by creating your own extension. Just use the same names as the one you
761 Here, we override the ``date`` filter with a custom one. Using this extension
762 is as simple as registering the ``MyCoreExtension`` extension by calling the
771 Adding a tag in an extension can be done by overriding the