
The configuration of links is now easier to follow in separate YAML files that are parsed by the YAML component. Instead, we have a menu system driven by the Routing component from Symfony. In Drupal 8, we no longer have the hook_menu. Links have separate configuration files, MODULE_MACHINE_: _permission: 'access administration pages' _controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' _controller: '\Drupal\user\Controller\UserController::userPage' Here are the same Drupal 7 paths as above from the user module in Drupal 8:Īll routes are defined in : Basic interaction with the new menu system is configuration-driven by appropriately named YAML files. It manages the 3 parts of a routing system - RouteCollection (all defined routes), RequestContext (request information), and UrlMatcher (mapping requests to routes). The matching of paths to controllers is now taken care of by Symfony's Routing component. It has been broken down into different systems. The functionality of the menu system is no longer monolithic. 'file path' => drupal_get_path('module', 'system'), 'access arguments' => array('access administration pages'), 'page callback' => 'system_admin_menu_block_page', 'description' => 'Configure user accounts.', "People" section in administration pages. 'access arguments' => array('administer users'), 'description' => 'Manage user accounts, roles, and permissions.', 'access callback' => 'user_register_access', 'page arguments' => array('user_register_form'), One of 3 tabs when anonymous users view /user path 'access callback' => 'user_is_anonymous',

Default tab when anonymous users view /user path Anonymous users see "User account" while authenticated users see "My account"

However, theres a Main menu block which is disabled. Examples from the user module: // user.module With this theme the Main menu is displayed as a bar with tabs it contains just the Home link by default. To define menu items, an implementation of hook_menu is required, which will register paths and specify how requests for a URL are handled. This system drives the way a user navigates the site. The menu system also renders menu items and tabs as well as action and contextual links.
#DRUPAL LOGIN LINK IN MENU CODE#
It is 4 lines of code and has calls to two Drupal functions: // index.php The menu system holds the key to understanding how Drupal handles an HTTP request received by the index.php file. There are two parts to the menu system in Drupal 7.

It is also responsible for how a request is directed to the right callback for a response to be generated. The menu system powers the navigation a user interacts with on a site.
