Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite203c40

Browse files
committed
[symfony#2865] Minor proofreading and tweaks thanks to@xabbuh and@stof about the services as global Twig variables
1 parent493a135 commite203c40

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎cookbook/templating/global_variables.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,17 @@ Referencing Services
8686
--------------------
8787

8888
Instead of using static values, you can also set the value to a service.
89-
Whenever the globalvariabele is accessed in the template, the service will be
89+
Whenever the globalvariable is accessed in the template, the service will be
9090
requested from the service container and you get access to that object.
9191

92-
This is done by prefixing the string with ``@``, which you already know from
93-
injecting a service:
92+
..note::
93+
94+
The service is not loaded lazily. In other words, as soon as Twig is
95+
loaded, your service is instantiated, even if you never use that global
96+
variable.
97+
98+
To define a service as a global Twig variable, prefix the string with ``@``.
99+
This should feel familiar, as it's the same syntax you use in service configuration.
94100

95101
..configuration-block::
96102

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp