Logo MutantMahesh
  • Dark Theme
    Light Theme Dark Theme System Theme
Logo Inverted Logo
  • Tags
  • access
  • custom
  • drupal
  • entity
  • filter
  • import
  • menu
  • plugin
  • python
  • terminal
  • tmux
  • views
Hero Image
How to write custom menu link tree manipulator

In this post, I will show you how to write custom menu link tree manipulator. In Drupal 9/10, we can write a custom menu link tree manipulator. For example, If you want to load the menu link tree sorted. The Drupal core provides the \Drupal\Core\Menu\DefaultMenuLinkTreeManipulators::generateIndexAndSort. This manipulator loads the sorted menu link tree as nested array but the keys of array also have the index. In this blog I am going to write a custom manipulator that will return the menu link tree sorted by menu link weight and maintain the array key as menu link plugin id.

December 20, 2023 Read
Navigation
  • About
  • Skills
  • Experiences
  • Education
  • Recent Posts
Contact me:
  • msankhala
  • Mahesh Sankhala

© 2023 Copyright.