Tip:
Highlight text to annotate it
X
Okay. So we've looked at the Controller class, we've looked at the routing dot yml file,
and so now let's look at our Hook menu. So I'll go back to the glue folder in our file
browser, and I'm going to open up the glue dot module file.
So we're looking at the Hook menu function down here and we're looking at a structure
that's similar to what you'd see in a Hook menu in Drupal 7 but with some differences.
You see, the URL here is the key to the array, and then the array includes a title and a
route name. This route name corresponds to the route name in the routing dot yml file.
If we take a look at that real quick, you'll see it right here at the top.
And then the URL here seems a little bit redundant because we have already defined it inside
of our routing file but what this tells Drupal is what the URL is for a menu link for this,
so when it comes to breadcrumbs or menu items, this is the URL that's going to be used.
The title right now should change the title on the page though we've seen, if we look
back at the browser, that it doesn't actually change the title right now because of a bug
in Drupal 8. But that will change.
And that's it for this example. You can see that the Hook menu implementation has been
simplified quite a bit because much of the data is now being provided by the routing file.