How to override a template
The templates provided by modules define a reference implementation of a specific theme hook. In our custom alps_weather
module, for example, we’ve defined a couple of theme hooks and their related templates. But if you look at Drupal core, or at other contrib modules, you’ll find that they’re full of such reference templates. Starting from the internal elements, up to page.html.twig
and html.html.twig
, every portion of a page is built by a theme hook and its Twig template.
We do that to separate where data is built from where data is rendered in HTML, and to allow themes to provide an alternate version of default templates.
Defining theme regions
Our demo website is simple, so we need fewer regions than the default set provided by Drupal core. To define them, we need to add those lines to the alps_trips.info.yml
file, inside the themes/custom/alps_trips
folder:
regions: header: Header breadcrumb: Breadcrumb...