Skip to content

Commit 29228c5

Browse files
committed
Merge branch '3.4' into 4.3
* 3.4: Remove references to the Twig extensions repo
2 parents c30ec24 + 659dba0 commit 29228c5

File tree

2 files changed

+20
-37
lines changed

2 files changed

+20
-37
lines changed

reference/dic_tags.rst

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,42 +1136,6 @@ For information on how to create the actual Twig Extension class, see
11361136
`Twig's documentation`_ on the topic or read the
11371137
:doc:`/templating/twig_extension` article.
11381138

1139-
Before writing your own extensions, have a look at the
1140-
`Twig official extension repository`_ which already includes several
1141-
useful extensions. For example ``Intl`` and its ``localizeddate`` filter
1142-
that formats a date according to user's locale. These official Twig extensions
1143-
also have to be added as regular services:
1144-
1145-
.. configuration-block::
1146-
1147-
.. code-block:: yaml
1148-
1149-
services:
1150-
Twig\Extensions\IntlExtension:
1151-
tags: [twig.extension]
1152-
1153-
.. code-block:: xml
1154-
1155-
<?xml version="1.0" encoding="UTF-8" ?>
1156-
<container xmlns="http://symfony.com/schema/dic/services"
1157-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1158-
xsi:schemaLocation="http://symfony.com/schema/dic/services
1159-
https://symfony.com/schema/dic/services/services-1.0.xsd">
1160-
1161-
<services>
1162-
<service id="Twig\Extensions\IntlExtension">
1163-
<tag name="twig.extension"/>
1164-
</service>
1165-
</services>
1166-
</container>
1167-
1168-
.. code-block:: php
1169-
1170-
$container
1171-
->register('Twig\Extensions\IntlExtension')
1172-
->addTag('twig.extension')
1173-
;
1174-
11751139
twig.loader
11761140
-----------
11771141

@@ -1296,6 +1260,5 @@ For an example, see the ``DoctrineInitializer`` class inside the Doctrine
12961260
Bridge.
12971261

12981262
.. _`Twig's documentation`: https://twig.symfony.com/doc/2.x/advanced.html#creating-an-extension
1299-
.. _`Twig official extension repository`: https://github.com/fabpot/Twig-extensions
13001263
.. _`SwiftMailer's Plugin Documentation`: http://swiftmailer.org/docs/plugins.html
13011264
.. _`Twig Loader`: https://twig.symfony.com/doc/2.x/api.html#loaders

reference/twig_reference.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,28 @@ Global Variables
624624
app
625625
~~~
626626

627+
<<<<<<< HEAD
627628
The ``app`` variable is injected automatically by Symfony in all templates and
628629
provides access to lots of useful application information. Read more about the
629630
:ref:`Twig global app variable <twig-app-variable>`.
630631

631632
.. _`default filters and functions defined by Twig`: https://twig.symfony.com/doc/2.x/#reference
633+
=======
634+
The ``app`` variable is available everywhere and gives access to many commonly
635+
needed objects and values. It is an instance of
636+
:class:`Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables`.
637+
638+
The available attributes are:
639+
640+
* ``app.user``, a PHP object representing the current user;
641+
* ``app.request``, a :class:`Symfony\\Component\\HttpFoundation\\Request` object;
642+
* ``app.session``, a :class:`Symfony\\Component\\HttpFoundation\\Session\\Session` object;
643+
* ``app.environment``, a string with the name of the execution environment;
644+
* ``app.debug``, a boolean telling whether the debug mode is enabled in the app;
645+
* ``app.token``, a :class:`Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface`
646+
object representing the security token
647+
* ``app.flashes``, returns flash messages from the session
648+
649+
.. _`Twig Reference`: https://twig.symfony.com/doc/2.x/#reference
650+
.. _`Twig Bridge`: https://github.com/symfony/symfony/tree/master/src/Symfony/Bridge/Twig/Extension
651+
>>>>>>> 3.4

0 commit comments

Comments
 (0)