July 2017
Intermediate to advanced
456 pages
11h 32m
English
A route is a way for Drupal to determine which system should be responsible for returning content to a request. For example, when it receives a request for /node, Drupal is able to match this to the home page and return the current list of content. Routes are defined in the {module}.routing.yml file inside the module directory. At its most basic, that file looks like:
mastering_drupal_8.test_page: path: 'mastering_drupal_8/test' defaults: _controller:'\Drupal\mastering_drupal_8\Controller\TestPageController::test' requirements: _permission: 'access content'
You have a name for the route, namespaced by the module that contains it. Within the route, other required elements are: path, the URL for the route; defaults, the default ...
Read now
Unlock full access