emulsify
emulsify copied to clipboard
Menu links not getting Drupal's link attributes
Looks like the menu link itself is a non-Twig template straggler leftover from D7 days of yore. This means, that when we do this instead of using {{ link(item.title, item.uri) }}
we lose any of Drupal attributes goodness (title, rel, data-drupal-link-system-path, etc.). We wanted to get away from this with the BEM function, so we need to rewrite this to be something like this:
{% set link_title %}
{# any icons, etc. can go here #}
{{ item.title }}
{% endset %}
{{ link(link_title, item.url, { 'class':[bem(item_base_class|default(menu_class ~ '__link'), item_modifiers)]} ) }}
☝️ Untested, but you get the idea.
It seems like the context isn't correct here or something. I'm using Menu Link Additions module to add classes to specific menu items but they aren't showing.