
Reply to comment
Drupal 8: Add menu item with anchor link programmatically in .menu.yml
For a Drupal 8 EU Cookie Compliance patch I needed a way to add an anchor link as default menu item programmatically in .menu.yml
example.anchor:
title: "Anchor example"
description: "Scroll to top on the current page"
url: "internal:#top"
See my addition in documentation: https://www.drupal.org/docs/drupal-apis/menu-api/providing-module-define...
Thanks to the comments in https://drupal.stackexchange.com/questions/229376/non-clickable-menu-ite...
and https://drupal.stackexchange.com/questions/280665/how-to-add-a-nolink-me... which helped me a lot to find this solution.
Reply
Julian Pustkuchen, M. Sc. Wirtschaftsinformatik ist passionierter Software- & Webentwickler mit den Schwerpunkten Softwaredesign, Objektorientierung sowie Usability- & Ablaufoptimierung bei webks. Ein weiterer Schwerpunkt ist die Entwicklung im CMS Drupal.
Entwickelt Julian gerade keine Software, fährt er Ski, Mountainbike, spielt Badminton, segelt oder verbringt Zeit mit Freunden.
Dieser Blog dient als sein "öffentlicher Notizblo(ck/g)".
Webbasierte Lösungen? Machen wir!
webks: websolutions kept simple
http://www.webks.de
Dir hat dieser Beitrag viel Zeit und Nerven gespart?
Dann freue ich mich über jede kleine Anerkennung:
Oder du suchst weitere professionelle Unterstützung?
Dann bietet dir unser webks.de Softwareentwickler-Team professionelle Dienstleistungen im Web-Development und der Drupal CMS Entwicklung!