October 2017
Intermediate to advanced
566 pages
14h 31m
English
In our "Hello World" module, we defined a couple of routes, one of which is the /hello path, which shows our themed salutation component. Let's create a link to that path that goes in the main menu that comes with Drupal core.
As I mentioned, menu links are defined inside a *.links.menu.yml file. So, let's create that file for our module and add our menu link definition in it:
hello_world.hello: title: 'Hello' description: 'Get your dynamic salutation.' route_name: hello_world.hello menu_name: main weight: 0
In a typical YAML notation, we have the machine name (in this case, also the plugin ID) hello_world.hello followed by the relevant information below it. These are the most common things you will define for a menu link: ...
Read now
Unlock full access