From e9bdb31f9a8a52e011a2da9e49e767d092f6bc1f Mon Sep 17 00:00:00 2001 From: Smaine Milianni Date: Thu, 16 Aug 2018 23:48:29 +0200 Subject: [PATCH 1/2] Add twig.runtime Hi everyone, Maybe there is a bunch of errors as It's the first time I'm writing a complete paragraph, As usual Reviews are welcome ! --- reference/dic_tags.rst | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index e95d1b7e5cd..3812f3ed2ad 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -41,6 +41,7 @@ Tag Name Usage `translation.dumper`_ Register a custom service that dumps translation messages `twig.extension`_ Register a custom Twig Extension `twig.loader`_ Register a custom service that loads Twig templates +`twig.runtime`_ Register a lazy-loaded Twig Extension `validator.constraint_validator`_ Create your own custom validation constraint `validator.initializer`_ Register a service that initializes objects before validation ======================================== ======================================================================== @@ -1175,6 +1176,55 @@ also register it manually: The ``priority`` value is optional and defaults to ``0``. The higher priority loaders are tried first. +.. _reference-dic-tags-twig-runtime: + +twig.runtime +-------------- + +**Purpose**: To register a custom Lazy-Loaded Twig Extension + +To enable a Lazy Loaded Twig extension, add it as a regular service in one of your +configuration and tag it with ``twig.runtime``. If you're using the +:ref:`default services.yaml configuration `, +the service is auto-registered and auto-tagged. But, you can also register it manually: + +.. configuration-block:: + + .. code-block:: yaml + + services: + App\Twig\AppExtension: + tags: [twig.runtime] + + .. code-block:: xml + + + + + + + + + + + + .. code-block:: php + + use App\Twig\AppExtension; + use App\Twig\AnotherExtension; + + $container + ->register(AppExtension::class) + ->addTag('twig.runtime') + ; + +For information on how to create the actual Runtime Twig Extension class, see +`Twig's documentation`_ on the topic or read the +:doc:`/templating/twig_extension#creating-lazy-loaded-twig-extensions` article. + validator.constraint_validator ------------------------------ From 4700e29d8a84d6ef79f5b5bafca39b86c3c549f3 Mon Sep 17 00:00:00 2001 From: Smaine Milianni Date: Sun, 26 Aug 2018 22:21:21 +0200 Subject: [PATCH 2/2] add ref to link twig runtime doc --- reference/dic_tags.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index 3812f3ed2ad..fc29fb8de0e 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -1223,7 +1223,7 @@ the service is auto-registered and auto-tagged. But, you can also register it ma For information on how to create the actual Runtime Twig Extension class, see `Twig's documentation`_ on the topic or read the -:doc:`/templating/twig_extension#creating-lazy-loaded-twig-extensions` article. +:ref:`Creating Lazy-Loaded Twig Extensions ` article. validator.constraint_validator ------------------------------