3

In my menu I want to add icons. Now when I look for a way to do this, I found a module called Menu Link Attributes. When I configure this on all my menu items, I can't only get it working when using the link function in twig. Now this is not a the expected way of working. Because in the module I add the class names of a awesome font icon. So I need to find a way to manually place the class in my twig file.

The module settings looks like:

attributes:
  class:
    label: ''
    description: ''

I treid using the {{ item.attributes }} in my menu.html.twig file but this is always empty.

Can someone help me on this? How can I place the class attribute in a custom i tag?

1
  • Did you figure this out? Trying to do the same.
    – Progonat
    Jun 6, 2018 at 18:09

1 Answer 1

1

There is a module available specifically for this use case, namely using Font Awesome icons as menu items: https://www.drupal.org/project/fontawesome_menu_icons

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.