December 2016
Beginner to intermediate
1005 pages
21h 54m
English
In Drupal, there are routes that represent URL paths that Drupal interprets to return content. Modules have the ability to define routes and methods that return data to be rendered and then displayed to the end user.
In this recipe, we will define a controller that provides an output and a route. The route provides a URL path that Drupal will associate with our controller to display the output.
Create a new module like the one in the first recipe. We will refer to the module as mymodule throughout the recipe. Use your module's name as appropriate.
src folder in your module's base directory and another folder named Controller inside it.MyPageController.php ...Read now
Unlock full access