@@ -561,10 +561,10 @@ Including this template from any other template is simple:
561
561
562
562
The template is included using the ``{{ include() }} `` function. Notice that the
563
563
template name follows the same typical convention. The ``articleDetails.html.twig ``
564
- template uses an ``article `` variable. This could be passed in by the `` list.html.twig ``
565
- template using the `` with `` command supported on a twig `` include `` tag. In this
566
- case however, we chose to use the twig `` include `` function which also passes context
567
- by default and passes also optional hashes however without the need for a `` with `` keyword .
564
+ template uses an ``article `` variable, which we pass to it. In this case,
565
+ you could avoid doing this entirely, as all of the variables available in
566
+ `` list.html.twig `` are also available in `` articleDetails.html.twig `` (unless
567
+ you set ` with_context<twig_include_function> `_ to false) .
568
568
569
569
.. tip ::
570
570
@@ -573,8 +573,9 @@ by default and passes also optional hashes however without the need for a ``with
573
573
elements, it would look like this: ``{'foo': foo, 'bar': bar} ``.
574
574
575
575
.. versionadded :: 2.2
576
- The ``include() `` function is a new Twig feature that's available in
577
- Symfony 2.2. Prior, the ``{% include %} `` tag was used.
576
+ The `include()<twig_include_function> `_ function is a new Twig feature
577
+ that's available in Symfony 2.2. Prior, the `{% include %}<twig_include_tag> `_
578
+ tag was used.
578
579
579
580
.. index ::
580
581
single: Templating; Embedding action
@@ -1537,3 +1538,5 @@ Learn more from the Cookbook
1537
1538
.. _`filters` : http://twig.sensiolabs.org/doc/filters/index.html
1538
1539
.. _`add your own extensions` : http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension
1539
1540
.. _`hinclude.js` : http://mnot.github.com/hinclude/
1541
+ .. _`twig_include_function` : http://twig.sensiolabs.org/doc/functions/include.html
1542
+ .. _`twig_include_tag` : http://twig.sensiolabs.org/doc/tags/include.html
0 commit comments