mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-01 21:17:21 +00:00
291bbe5b8e2984e61987ed16ff03384c097802da
This PR was squashed before being merged into the 2.x branch (closes #3019).
Discussion
----------
Local macros auto-import
closes #1758, closes #861
This implements auto-import for macros defined in a template. To avoid BC breaks, I've decided to do the auto-import as the equivalent of `{% import _self as _self %}`, so local macros are loaded under the `_self` pseudo-variable:
```twig
{{ _self.hello("Fabien") }}
{% macro hello(name) -%}
Hello {{ name }}
{% endmacro %}
```
~~Note that this is done via a new extension that you need to explicitly enable for now. We can remove the need for the extension, just not sure if we want it. WDYT?~~
Commits
-------
3fcbc442 Local macros auto-import
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. More Information ---------------- Read the `documentation`_ for more information. .. _documentation: https://twig.symfony.com/documentation
Description
Languages
PHP
99.9%