- Issue created by @AaronChristian
- Status changed to Needs work
over 1 year ago 4:33pm 24 March 2023
In TWIG 1 macros had a global scope within your project. I believe it was removed due to security concerns. However there should be a way to call the function since its essentially just a php function.
https://git.drupalcode.org/project/bootstrap_ui_kit/-/blob/1.x/src/TwigE...
I started the functionality but it failed to load when i called it.
I've been calling the function with;
{{ macros_color('swatch', { 'primary' }) }}
The idea being you can call the macro without explicitly importing it into our section, which means less customization.
For example;
color.html.twig
Should be able to access macros inside of;
color.macros.twig
Without having to use the direct import statement via TWIG inside of color.html.twig;
{% import '@bootstrap_ui_kit/ui-kit/' ~ section.id ~ '/' ~ section.id ~ '.macros.twig' as macros %}
Needs work
1.0
Code