Module Description
Patch #75 is available for Drupal 9.1.x and it works! You might want to use skip this module and use the patch instead if you only want to filter menu by language.

This module started as a workaround to this 6+ years old issue in core. It helps site builders to easily filter menu by language with a few clicks and it provides developers with a custom service to manipulate menus (see example in code).

Current available manipulators

* Add custom icon to menu items
* Filter menu items by current language
* ...anything else you'd like this module to do? (open an issue)

How to install
composer require drupal/menu_manipulator drush en menu_manipulator -y How to use
Go to Admin > Configuration > User Interface.

Filter by language Select which menus have to be filtered by language. Menu items will be hidden if not translated into the current language OR if they points to an entity which does not have translation for the current language.

Menu icons Populate the custom list in settings and select which menus should have icons.

Edit your menu items and select an icon from the dropdown list.

Icon will be available in your Twig template as follow:

{% for item in items %} <li{{ item.attributes }}> {# If, for any reason, item.icon is empty, you can retrieve it like this: #} {% set icon = item['#icon'] ?: item.original_link.getOptions().icon %} {# Embed icon inside link text #} {% set link_text %} {% if icon %} {# Example of an SVG icon as a Twig template #} {% include '@yourtheme/icons/icon.html.twig' with { icon: icon } %} {# Example of icon as CSS background image #} <span class="icon icon--{{ icon }}"></span> {# Hide the text #} <span class="visually-hidden">{{ item.title }}</span> {% else %} {# No icon, display the text only #} <span class="menu-item-label">{{ item.title|raw }}</span> {% endif %} {% endset %} {{ link(link_text, item.url) }} {% if item.below %} {{ menus.menu_links(item.below, attributes, menu_level + 1) }} {% endif %} </li> {% endfor %} Known issues

* Apply this patch to fix the compatibility issue with SuperFish module

Recommended/complementary modules

* Menu Manipulator Sitemap
* Link attributes
* Menu Link attributes

Similar projects

* Menu Multilingual: acheives same results but more configurations needed.
* Menu Language Filter: for Drupal 7 only.
* Menu Item Extras: makes menu_link_content fieldable

Any questions? Found a bug? Need another menu manipulator?Please create a new issue here.

Project Usage
2456
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
This module aims to solve the issue of easily filtering menus by language for site builders and providing developers with custom menu manipulation services.
Data Name
menu_manipulator

OPENAI CHATBOT

OPENAI CHATBOT

16:27:08
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.