S
S
semki0962018-11-04 14:11:36
Drupal
semki096, 2018-11-04 14:11:36

How to add class to menu link in Drupal8?

I created my theme in Drupal 8, inheriting the Stabil theme. Now I want to add classes to the navigation. I look at the links.html.twig file, and I see . What does item.attributes mean, what should I do to get the class I need in this variable?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
andead, 2018-11-04
@semki096

{{ item.attributes.addClass('class-name') }}

W
WiseUkraine, 2018-12-18
@WiseUkraine

https://www.drupal.org/project/menu_link_attributes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question