Skip to content

Commit

Permalink
Merge branch '4.3' into 4.4
Browse files Browse the repository at this point in the history
* 4.3:
  Remove references to the Twig extensions repo
  • Loading branch information
javiereguiluz committed Nov 30, 2019
2 parents c7c3ee7 + 29228c5 commit 85a48d7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 37 deletions.
37 changes: 0 additions & 37 deletions reference/dic_tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1136,42 +1136,6 @@ For information on how to create the actual Twig Extension class, see
`Twig's documentation`_ on the topic or read the
:doc:`/templating/twig_extension` article.

Before writing your own extensions, have a look at the
`Twig official extension repository`_ which already includes several
useful extensions. For example ``Intl`` and its ``localizeddate`` filter
that formats a date according to user's locale. These official Twig extensions
also have to be added as regular services:

.. configuration-block::

.. code-block:: yaml
services:
Twig\Extensions\IntlExtension:
tags: [twig.extension]
.. code-block:: xml
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
https://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="Twig\Extensions\IntlExtension">
<tag name="twig.extension"/>
</service>
</services>
</container>
.. code-block:: php
$container
->register('Twig\Extensions\IntlExtension')
->addTag('twig.extension')
;
twig.loader
-----------

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

.. _`Twig's documentation`: https://twig.symfony.com/doc/2.x/advanced.html#creating-an-extension
.. _`Twig official extension repository`: https://github.com/fabpot/Twig-extensions
.. _`SwiftMailer's Plugin Documentation`: http://swiftmailer.org/docs/plugins.html
.. _`Twig Loader`: https://twig.symfony.com/doc/2.x/api.html#loaders
20 changes: 20 additions & 0 deletions reference/twig_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,28 @@ Global Variables
app
~~~

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

.. _`default filters and functions defined by Twig`: https://twig.symfony.com/doc/2.x/#reference
=======
The ``app`` variable is available everywhere and gives access to many commonly
needed objects and values. It is an instance of
:class:`Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables`.

The available attributes are:

* ``app.user``, a PHP object representing the current user;
* ``app.request``, a :class:`Symfony\\Component\\HttpFoundation\\Request` object;
* ``app.session``, a :class:`Symfony\\Component\\HttpFoundation\\Session\\Session` object;
* ``app.environment``, a string with the name of the execution environment;
* ``app.debug``, a boolean telling whether the debug mode is enabled in the app;
* ``app.token``, a :class:`Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface`
object representing the security token
* ``app.flashes``, returns flash messages from the session

.. _`Twig Reference`: https://twig.symfony.com/doc/2.x/#reference
.. _`Twig Bridge`: https://github.com/symfony/symfony/tree/master/src/Symfony/Bridge/Twig/Extension
>>>>>>> 3.4

0 comments on commit 85a48d7

Please sign in to comment.