hi everyone ! I’m trying to test if a plugin is enabled, it’s super easy just check config.plugins array, but it doesn’t work with a plugin name with more than two words separated with a dash like my-plugin-name I think i miss something in twig
config.plugins
my-plugin-name
twig
— twig {% if config.plugins.my-plugin-name.enabled %} Plugin enabled {% endif %}
Thanks a lot for tips
That’s because Twig doesn’t allow hyphens in variable names like that. You need to do {% if config.plugins['my-plugin-name'].enabled %}.
{% if config.plugins['my-plugin-name'].enabled %}
It’s not super obvious, but the Twig docs do mention this in the “Variables” section of the Twig for Template Designers page.
@Perlkönig that’s it thanks for your help