twigphp/Twig — pull request #1561 by blogsh (2014-11-05 23:51:21+00:00)
Title: Added use statement for embed tag

My proposal for #1560.

It makes it possible to use the `print` block form the main template within the `embed` area in the following example:

{# layout.html #}

Website

{% block content '' %}

{# panel.html #}

{% block content '' %}

{# index.html #}
{% extends 'layout.html.twig' %}

{% block print %}
{{ x }}
{% endblock %}

{% block content %}
{% embed 'panel.html.twig' use print %}
{% block content %}
{% for x in ['a', 'b', 'c'] %} {{ block('print') }} {% endfor %}
{% endblock %}
{% endembed %}
{% endblock %}

What has been added is the `use` keyword for the `embed` tag. Maybe the implementation is not optimal, since I just skimmed over the source to see how stuff is usually done, but I can improve it if you're interested in including this.