{# @var craft \craft\web\twig\variables\CraftVariable #} {# @var entry \craft\elements\Entry #} {# a-headline ------------------------------------------------------------ #} {# -- Set Defaults -- #} {% set defaults = { cn: 'a-headline', modifiers: [], customClasses: [], data: {}, js: null, text: null, size: 'h2' } %} {# -- Merge Default with Options -- #} {% set opt = opt is defined ? defaults|merge(opt) : defaults %} {# -- Modul -- #} {% if opt.text %} <{{ opt.size }} class="{{ opt.cn }} {% for modifier in opt.modifiers %} {{ modifier | length ? ' ' ~ opt.cn ~ '--' ~ modifier }} {% endfor %} {% for customClass in opt.customClasses %} {{ customClass | length ? ' ' ~ customClass }} {% endfor %} {{ opt.js ? opt.cn|replace({ 'a-' : 'js-' }) : '' }}" {% for key, value in opt.data %} {{ 'data-' ~ key ~ '=' ~ value }} {% endfor %}> {{ opt.text }} {% endif %}