5
Creating Custom Pages
In this chapter, we will make custom pages with controllers. A controller is a class that contains a method used to build a page when Drupal is accessed at a specific path. Creating custom pages allows you to extend Drupal beyond just the content pages. This chapter will cover the process of creating custom pages, receiving dynamic values from paths, and serving JSON or file download responses.
In this chapter, we will learn about the following recipes:
- Defining a controller to provide a custom page
- Using route parameters
- Creating a dynamic redirect page
- Creating a JSON response
- Serving files for download
Technical requirements
This chapter requires an existing custom module installed on your Drupal site. This custom ...
Get Drupal 10 Development Cookbook - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.