3
How Drupal Renders an HTML Page
In this chapter, we’ll start to dive into the layers of Drupal that deal with the frontend.
You will learn where a page comes from, how it is assembled, and by which parts. We’ll see what a template is and how it is used by Drupal (and Twig) to deliver an HTML page. Then we’ll talk about theme hooks and render arrays, the structures that Drupal has to mix templates and contents together.
Additionally, you will learn how to define a library to attach custom CSS and JavaScript files to a page.
Finally, you will see how to deliver the content of a controller action as a dialog.
By the end of the chapter, you’ll master the render pipeline of Drupal, and you’ll understand how Drupal builds all its pages.
This chapter ...
Get Modernizing Drupal 10 Theme Development 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.