Make twig macros available across multiple component partials.
0
In your plugin, create a views/twig folder and add a file named macros.htm in this folder.
{% macro myMacro(vars) %}
{# do something with vars #}
{% endmacro %}
In your components partials, use this to make the macros available:
{% import "author.plugin::twig.macros" as macros %}
{# you can now use macros.myMacro(_context) #}
Note: the _context argument passes the variables visible from the calling partial.
There are no comments yet
Be the first one to comment