Skip to content

Improved the description of the Twig global variables #6535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions book/templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1202,15 +1202,22 @@ instance which will give you access to some application specific variables
automatically:

``app.security``
The security context.
The :class:`Symfony\Component\Security\Core\SecurityContext` object or
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and here

``null`` if there is none.
``app.user``
The current user object.
The representation of the current user or ``null`` if there is none. The
value stored in this variable can be a :class:`Symfony\Component\Security\Core\User\UserInterface`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the backslashes have to be doubled

object, any other object which implements a ``__toString()`` method or even
a regular string.
``app.request``
The request object.
The :class:`Symfony\Component\HttpFoundation\Request` object that represents
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

the current request (depending on your application, this can be a sub-request
or a regular request, as explained later).
``app.session``
The session object.
The :class:`Symfony\Component\HttpFoundation\Session\Session` object that
represents the current user's session or ``null`` if there is none.
``app.environment``
The current environment (dev, prod, etc).
The name of the current environment (``dev``, ``prod``, etc).
``app.debug``
True if in debug mode. False otherwise.

Expand Down