Skip to content
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

use the include() Twig function instead of the tag #5548

Merged
merged 1 commit into from
Jul 25, 2015
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions book/templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,9 @@ you set `with_context`_ to false).
maps (i.e. an array with named keys). If you needed to pass in multiple
elements, it would look like this: ``{'foo': foo, 'bar': bar}``.

.. versionadded:: 2.2
.. versionadded:: 2.3
The `include() function`_ is a new Twig feature that's available in Symfony
2.2. Prior, the `{% include %} tag`_ tag was used.
2.3. Prior, the `{% include %} tag`_ tag was used.
Copy link
Member

Choose a reason for hiding this comment

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

the function was introduced in Twig 1.12, supported by all Symfony 2.x releases. Not sure if we need this versionadded at all...

Copy link
Member Author

Choose a reason for hiding this comment

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

In the contribution docs we have it with 2.3. Since Symfony 2.3 was the first version requiring Twig 1.12 or above (Symfony 2.2 could have been used with Twig 1.11) I decided to make the change here. But I don't have any hard feelings about this. It should just be consistent.


.. index::
single: Templating; Embedding action
Expand Down
10 changes: 5 additions & 5 deletions cookbook/profiler/data_collector.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ following example can help you get started:
</div>
{% endset %}

{# Set the "link" value to false if you do not have a big "panel"
{# Set the "link" value to false if you do not have a big "panel"
section that you want to direct the user to. #}
{% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': true } %}
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { 'link': true }) }}

{% endblock %}

{% block head %}
{# Optional, if you need your own JS or CSS files. #}
{{ parent() }} {# Use parent() to keep the default styles #}
{# Optional, if you need your own JS or CSS files. #}
{{ parent() }} {# Use parent() to keep the default styles #}
{% endblock %}

{% block menu %}
Expand All @@ -151,7 +151,7 @@ following example can help you get started:
{% endblock %}

{% block panel %}
{# Optional, for showing the most details. #}
{# Optional, for showing the most details. #}
<h2>Example</h2>
<p>
<em>Major information goes here</em>
Expand Down
8 changes: 4 additions & 4 deletions cookbook/templating/namespaced_paths.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Take the following paths as an example:
.. code-block:: jinja

{% extends "AppBundle::layout.html.twig" %}
{% include "AppBundle:Foo:bar.html.twig" %}
{{ include('AppBundle:Foo:bar.html.twig') }}

With namespaced paths, the following works as well:

.. code-block:: jinja

{% extends "@App/layout.html.twig" %}
{% include "@App/Foo/bar.html.twig" %}
{{ include('@App/Foo/bar.html.twig') }}

Both paths are valid and functional by default in Symfony.

Expand Down Expand Up @@ -80,7 +80,7 @@ called ``sidebar.twig`` in that directory, you can use it easily:

.. code-block:: jinja

{% include '@foo_bar/sidebar.twig' %}
{{ include('@foo_bar/sidebar.twig') }}

Multiple Paths per Namespace
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -134,4 +134,4 @@ in the previous three directories:

.. code-block:: jinja

{% include '@theme/header.twig' %}
{{ include('@theme/header.twig') }}