In this tutorial we will learn how to add items to the menu system from within a custom module. We will also look at the options available for configuring our new menu item. Lastly, we'll learn about using
hook_menu_links_discovered_alter() that can be used to add new menu items, or alter the behavior of existing ones.
When a user visits a particular URL on a Drupal site, the path they are visiting is a route. Drupal's routing system helps figure out which controller is responsible for responding to the route being requested. Drupal matches the incoming request's path to a controller by looking through the routes that have been registered in active modules.
- Create your own routes in custom modules
- Understand how Drupal's routing system maps paths to controllers
At this point in the development cycle of Drupal 8 the routing system is relatively stable. This is mainly because Drupal's routing system leverages the Symfony routing component.
This tutorial walks through the process of creating a custom content entity. Since there are several url paths that will display various types of information about our custom entity there are multiple examples of registering routes in this tutorial as well.