Issue #3483209 by mogtofu33, finnsky, pdureau: Navigation leverage icon core API
Closes #3483209
Merge request reports
Activity
added 2 commits
added 29 commits
Toggle commit list9 9 {% macro menu_items(items, attributes, menu_level) %} 10 10 {% for item in items %} 11 11 12 {% set icon_id = null %} 13 {% if item.original_link.pluginId is defined %} 14 {% set icon_id = item.original_link.pluginId|split('.')|last %} 15 {% elseif item.class is defined %} 16 {% set icon_id = item.class|split('.')|last %} 17 {% endif %} changed this line in version 12 of the diff
9 9 {% macro menu_items(items, attributes, menu_level) %} 10 10 {% for item in items %} 11 11 12 {% set icon_id = null %} 13 {% if item.original_link.pluginId is defined %} 14 {% set icon_id = item.original_link.pluginId|split('.')|last %} Using the last part of the menu plugin link id does appear to present an issue that should be addressed. For instance, currently, the People menu link is identified by
entity.user.collection
. This logic will come up with anicon_id
ofcollection
, and the/core/modules/navigation/assets/icons/collection.svg
gets used, which is an icon of two persons. That works, b/c out of the box there is only one top-level menu link plugin id ending incollection
. However, there are many menu link ids that end incollection
, and you can imagine a scenario where another top-level menu link is placed in the Admin menu and would end up using the same icon. As a contrived example, consider this alter hook:/** * Implements hook_menu_links_discovered_alter(). */ function mymodule_menu_links_discovered_alter(&$links) { if (isset($links['entity.block_content_type.collection'])) { $links['entity.block_content_type.collection']['parent'] = 'system.admin'; } }
This puts the "Block types" menu link (
/en/admin/structure/block-content
) at the top level where it gets placed into the Navigation and gets the collection.svg icon, which is quite unexpected:Edited by m4oliveiTo be clear, you can also run into this awkward situation if you just re-order your Admin menu and pull a menu item with id
*.collection
to the top level. eg.changed this line in version 12 of the diff
added 45 commits
-
0e2799b6...6dd918c9 - 37 commits from branch
project:11.x
- 3eabc461 - Issue #3483209 by mogtofu33, finnsky, pdureau: Navigation leverage icon core API
- 3ed52aee - fix: replace title component with icon
- 407f24ab - fix: announcement icon direction
- 81a9517a - fix: set toolbar message icon
- b6ef9436 - Frontend isons integration
- f1814116 - fix: icon announcements scale
- bdbd7f9d - Move condition to CSS
- 8e936331 - Try to fix test
Toggle commit list-
0e2799b6...6dd918c9 - 37 commits from branch
added 16 commits
-
ac767e52...f666681c - 15 commits from branch
project:11.x
- 790cc4c8 - Merge branch '11.x' into 3483209-navigation-use-icon-api
-
ac767e52...f666681c - 15 commits from branch
added 22 commits
-
18e2ea61...0c430949 - 12 commits from branch
project:11.x
- 381ed9a1 - Issue #3483209 by mogtofu33, finnsky, pdureau: Navigation leverage icon core API
- 69eb2a15 - fix: replace title component with icon
- b57101de - fix: announcement icon direction
- 3034dd7d - fix: set toolbar message icon
- cc73ae00 - Frontend isons integration
- b6fa41d8 - fix: icon announcements scale
- 9d331d22 - Move condition to CSS
- 3ec81190 - Try to fix test
- 090bbe44 - Fixed chevron
- 1c429af0 - Revert co clean class
Toggle commit list-
18e2ea61...0c430949 - 12 commits from branch
added 18 commits
-
99db0d51...bb1f2a6d - 6 commits from branch
project:11.x
- bb1f2a6d...1476f9f7 - 2 earlier commits
- ea8ba9c3 - fix: announcement icon direction
- 06e10921 - fix: set toolbar message icon
- 000099db - Frontend isons integration
- 433d3491 - fix: icon announcements scale
- cc13e71c - Move condition to CSS
- 0239ad17 - Try to fix test
- 77dd6678 - Fixed chevron
- de43e784 - Revert co clean class
- 3cfae452 - Fixed feedbacks
- bbea0524 - Issue #3483209: Fix test
Toggle commit list-
99db0d51...bb1f2a6d - 6 commits from branch