Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Menu links not getting Drupal's link attributes #323

Open
evanmwillhite opened this issue Feb 5, 2019 · 1 comment
Open

Menu links not getting Drupal's link attributes #323

evanmwillhite opened this issue Feb 5, 2019 · 1 comment

Comments

@evanmwillhite
Copy link
Contributor

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.

@ace4it
Copy link

ace4it commented May 13, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants