#! code: Drupal 9: Creating A Category Menu Using Derivers

Derivers in Drupal are one of the ways in which you can inform Drupal about the presence of plugin types. This allows you to generate multiple custom types of a plugin so that it can be represented as multiple different plugins within the system.

Perhaps the most useful deriver example I have seen is the menu deriver. This allows us to use the Drupal plugin architecture to generate custom menu links.

If you want to create a menu link for your module then you would normally add them one at a time to a *.links.menu.yml file. This is an example of using the menu links plugin system to inform the menu system about the links you want to add.

For example, the core config module has a single option in the config.links.menu.yml file that adds the “Configuration synchronization” menu item to the administration menu. Here is the contents of that file.

config.sync:
  title: 'Configuration synchronization'
  description: 'Import and export your configuration.'
  route_name: config.sync
  parent: system.admin_config_development

Instead of doing this, we can use a menu deriver to tell the menu system to look at a class that will then inject menu links into the menu. This saves us from adding them one by one and also means we can dynamically create menu links without hard coding them into the *.links.menu.yml file.

In this article, I will look at setting up a menu deriver and then using that deriver to inject custom elements into the menu.

Setting Up A Menu Deriver

The first thing to do is setup a menu deriver class. This should implement a method called getDerivativeDefinitions() which will return the plugin derivatives. As we are calling this from the menu system we need to return an array of menu links from this method so that they are understood by the menu system.

Read more.

Inilah Persiapan Flypast 18 Pesawat Tempur F-16 TNI AU Untuk HUT KE-77 RI

Video by via Dailymotion Source JAKARTA, KOMPAS.TV Pesawat tempur TNI AU tengah mempersiapkan demo udara nusantara flight dan giant flag untuk memeriahkan HUT ke 77 RI. Terdapat 18 pesawat tempur F-16 TNI AU menggelar latihan yang kedua kalinya untuk memeriahkan HUT ke-77 RI. Persiapan dilakukan sejak pukul 7:00wib di Lanud Halim Perdanakusuma, Minggu (14/8/2022). Baca … Read more

Normandie : les habitants d’Étretat en colère face à l’afflux massif de touristes

Video by via Dailymotion Source ABONNEZ-VOUS pour plus de vidéos : http://www.dailymotion.com/Europe1fr Retrouvez “Europe Midi – Week-end” sur : http://www.europe1.fr/emissions/europe-1-midiLE DIRECT : http://www.europe1.fr/direct-video Retrouvez-nous sur : | Notre site : http://www.europe1.fr | Facebook : https://www.facebook.com/Europe1 | Twitter : https://twitter.com/europe1 | Google + : https://plus.google.com/+Europe1/posts | Pinterest : http://www.pinterest.com/europe1/ Go to Source

Minister Jagadish Reddy Slams Bandi Sanjay Over Comments On CM KCR _ V6 News

Video by via Dailymotion Source నల్గొండ క్లాక్ టవర్ దగ్గర జాతీయ జెండాను ఆవిష్కరించిన: మంత్రి జగదీశ్ రెడ్డి |v6 News నిరూపిస్తే తల నరుక్కుంటా | డిస్కవరీల కాళేశ్వరం గాయబ్https://youtu.be/jJNVNHZJ-zw రాజీనామా చేస్తాhttps://youtu.be/VaN8WEzGh0w డిస్కవరీల కాళేశ్వరం గాయబ్https://youtu.be/Fy_cILlFxUU మంత్రి కాల్పులుhttps://youtu.be/VaN8WEzGh0w అవినీతిల ఆళ్లే తోపుhttps://youtu.be/Fs0XmgbiiQU► Subscribe to V6 News : https://www.youtube.com/c/V6NewsTelugu► Subscribe to V6 Life : https://www.youtube.com/c/V6Life► Follow Us On Dailymotion : https://www.dailymotion.com/v6newstelugu► Like us on … Read more

Emmanuel Macron, le président et le jet-ski

Video by via Dailymotion Source Certes, les photos sur lesquelles on voit Emmanuel Macron chevaucher, à demi-nu sous son gilet noir pare-balles et pare-chocs, un impressionnant jet-ski sur l’écume des vagues de la Méditerranée ont été prises il y a huit jours. C’était au tout début de ses vacances. « Enfin, les vacances avec Brigitte … Read more

มิว-ศุภศิษฏ์ กับ The Hacker Project โปรเจ็กต์แห่งปีจาก Gucci | GQ Uncut

Video by via Dailymotion Source จากการตั้งคำถามเรื่องสินค้าละเมิดลิขสิทธิ์ในอุตสาหกรรมแฟชั่นสู่โปรเจ็กต์แห่งปี #TheHackerProject ที่ #GQUncut ได้ มิว-ศุภศิษฏ์ มาร่วมนำเสนอสไตล์เท่แบบใหม่ ซึ่งเป็นการร่วมงานระหว่างกุชชี่ (#Gucci) และบาเลนเซียก้า (#Balenciaga) บอกเลยว่าครั้งนี้มิวได้ฉีกกรอบสไตล์ที่ผ่านมาได้อย่างน่าสนใจเลยทีเดียว #GQUncutxMewxGucci Go to Source

Osmanlı’dan Günümüze Ramazanlar | Prof. Ahmet Şimşirgil

Video by via Dailymotion Source – Ramazan günlerini iyi değerlendirelim– Şu üçünü iyi öğrenin: Ehli Sünnet’e Göre Dininizi, tarihinizi ve edebiyatınızı– Korona (corona)’nın düşündürdükleri Osmanlı’da Ramazan ayları nasıl geçirilirdi? Osmanlı’nın Ramazan’a verdiği önem nasıldı? Günümüzde Ramazan’daki yaşantı ile şimdiki arasında ne gibi farklar var? Prof. Ahmet Şimşirgil anlatıyor.. Fatih Gençlik Vakfı Tanıtım Filmi:https://www.youtube.com/watch?v=iQZ-h…Sitelerhttp://www.fgv.org.tr/Sosyal Medya:https://www.facebook.com/mttbliler/https://twitter.com/mttbliler Diğer … Read more