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

Mention the official Twig extensions#9035

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
javiereguiluz merged 1 commit intosymfony:4.0fromjaviereguiluz:finish_7616
Jan 12, 2018
Merged
Changes fromall commits
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
12 changes: 12 additions & 0 deletionstemplating/twig_extension.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,17 @@ If you need to create custom Twig functions, filters, tests or more, you'll need
to create a Twig extension. You can read more about `Twig Extensions`_ in the Twig
documentation.

.. tip::

Before writing your own Twig extension, check if the filter/function that
you need is already implemented in the :doc:`Symfony Twig extensions </reference/twig_reference>`.
Check also the `official Twig extensions`_, which can be installed in your
application as follows:

.. code-block:: terminal

$ composer require twig/extensions

Create the Extension Class
--------------------------

Expand DownExpand Up@@ -62,6 +73,7 @@ you're done! Symfony will automatically know about your new service and add the

You can now start using your filter in any Twig template.

.. _`official Twig extensions`: https://github.com/twigphp/Twig-extensions
.. _`Twig extensions documentation`: http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension
.. _`global variables`: http://twig.sensiolabs.org/doc/advanced.html#id1
.. _`functions`: http://twig.sensiolabs.org/doc/advanced.html#id2
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp