Skip to content

Commit 4e9b044

Browse files
committed
Added the missing versionadded directive
1 parent cb102c1 commit 4e9b044

File tree

1 file changed

+6
-45
lines changed

1 file changed

+6
-45
lines changed

templating/twig_extension.rst

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -134,51 +134,12 @@ previous ``priceFilter()`` method::
134134
}
135135
}
136136

137-
Register the Lazy-Loaded Extension as a Service
138-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
139-
140-
Finally, register your new class as a service and tag it with ``twig.runtime``
141-
(and optionally inject any service needed by the Twig extension runtime):
142-
143-
.. configuration-block::
144-
145-
.. code-block:: yaml
146-
147-
# app/config/services.yml
148-
services:
149-
app.twig_runtime:
150-
class: AppBundle\Twig\AppRuntime
151-
public: false
152-
tags:
153-
- { name: twig.runtime }
154-
155-
.. code-block:: xml
156-
157-
<!-- app/config/services.xml -->
158-
<?xml version="1.0" encoding="UTF-8" ?>
159-
<container xmlns="http://symfony.com/schema/dic/services"
160-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
161-
xsi:schemaLocation="http://symfony.com/schema/dic/services
162-
http://symfony.com/schema/dic/services/services-1.0.xsd">
163-
164-
<services>
165-
<service id="app.twig_runtime"
166-
class="AppBundle\Twig\AppRuntime"
167-
public="false">
168-
<tag name="twig.runtime" />
169-
</service>
170-
</services>
171-
</container>
172-
173-
.. code-block:: php
174-
175-
// app/config/services.php
176-
use AppBundle\Twig\AppExtension;
177-
178-
$container
179-
->register('app.twig_runtime', AppRuntime::class)
180-
->setPublic(false)
181-
->addTag('twig.runtime');
137+
.. versionadded:: 3.4
138+
The ``RuntimeExtensionInterface`` was introduced in Symfony 3.4.
139+
140+
If you're using the default ``services.yaml`` configuration, this will already
141+
work! Otherwise, :ref:`create a service <service-container-creating-service>`
142+
for this class and :doc:`tag your service </service_container/tags>` with ``twig.runtime``.
182143

183144
.. _`Twig extensions documentation`: http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension
184145
.. _`global variables`: http://twig.sensiolabs.org/doc/advanced.html#id1

0 commit comments

Comments
 (0)