Fabien Potencier 1a95a0bafe minor #3377 Macro not available in embed tags (GromNaN)
This PR was merged into the 2.x branch.

Discussion
----------

Macro not available in embed tags

Macro imported globally in a template via `import` or `from` are not available inside `embed` tags.
This behavior is present since Twig v2.0.0. I think it needs to be documented. Feel free to suggest an other text.

Here is some example :

- If the macro is imported globally, it's not available inside the `embed` tag, we get an error : https://twigfiddle.com/jwtwm3
```twig
{% import 'macro.twig' as macro %}
{% embed 'embed.twig' %}
    {% block content %}
        {{ macro.sayhello('Jérôme') }}
    {% endblock %}
{% endembed %}
```
- Whereas is the macro is imported inside the `embed` tag, it's available in its `block` tags : https://twigfiddle.com/jwtwm3/2
```twig
{% embed 'embed.twig' %}
    {% import 'macro.twig' as macro %}
    {% block content %}
        {{ macro.sayhello('Jérôme') }}
    {% endblock %}
{% endembed %}
```

Commits
-------

be291441 Update doc for macro with embed tags
2020-07-29 08:07:02 +02:00
2020-07-29 02:33:15 +02:00
2020-07-29 03:03:03 +02:00
2020-06-22 08:11:03 +02:00
2020-07-06 15:35:12 +02:00
2020-07-29 03:03:03 +02:00
2019-08-08 18:07:29 +02:00
2020-05-21 11:54:27 +02:00
2020-07-06 13:59:53 +02:00
2020-05-21 11:15:20 +02:00
2020-06-22 09:23:14 +02:00
2020-02-11 17:31:46 +01:00
2020-04-06 19:23:50 +02:00

Twig, the flexible, fast, and secure template language for PHP
==============================================================

Twig is a template language for PHP, released under the new BSD license (code
and documentation).

Twig uses a syntax similar to the Django and Jinja template languages which
inspired the Twig runtime environment.

Sponsors
--------

.. raw:: html

    <a href="https://blackfire.io/docs/introduction?utm_source=twig&utm_medium=github_readme&utm_campaign=logo">
        <img src="https://static.blackfire.io/assets/intemporals/logo/png/blackfire-io_secondary_horizontal_transparent.png?1" width="255px" alt="Blackfire.io">
    </a>

More Information
----------------

Read the `documentation`_ for more information.

.. _documentation: https://twig.symfony.com/documentation
Languages
PHP 99.9%