|
5 | 5 | How to Work with Service Tags
|
6 | 6 | =============================
|
7 | 7 |
|
8 |
| -Some container services require to be registered or used in some special way. |
9 |
| -Consider for example the :doc:`Twig extensions </templating/twig_extension>`: |
10 |
| -they are PHP classes that must be added to the main Twig object before using |
11 |
| -them. If you define those exensions as regular Symfony services, Twig will |
12 |
| -ignore them and an exception will be thrown when using them in templates. |
13 |
| - |
14 | 8 | **Service tags** are a way to tell Symfony or other third-party bundles that
|
15 | 9 | your service should be registered in some special way. Take the following
|
16 | 10 | example:
|
@@ -57,14 +51,12 @@ example:
|
57 | 51 | ->addTag('twig.extension');
|
58 | 52 |
|
59 | 53 | Services tagged with the ``twig.extension`` tag are collected during the
|
60 |
| -initialization of TwigBundle to enable them as Twig extensions. In this example, |
61 |
| -that's why Symfony knows that the ``app.twig_extension`` service should be |
62 |
| -registered as a Twig extension. |
63 |
| - |
64 |
| -For a list of all the tags available in the core Symfony Framework, check |
65 |
| -out :doc:`/reference/dic_tags`. Each of these has a different effect on your |
66 |
| -service and many tags require additional arguments (beyond just the ``name`` |
67 |
| -parameter). |
| 54 | +initialization of TwigBundle and added to Twig as extensions. |
| 55 | + |
| 56 | +Other tags are used to integrate your services into other systems. For a list of |
| 57 | +all the tags available in the core Symfony Framework, check out |
| 58 | +:doc:`/reference/dic_tags`. Each of these has a different effect on your service |
| 59 | +and many tags require additional arguments (beyond just the ``name`` parameter). |
68 | 60 |
|
69 | 61 | Creating custom Tags
|
70 | 62 | --------------------
|
|
0 commit comments