Layouts
As part of the Drupal 8 release cycle, the Layouts API has been introduced to provide contributed modules with a unified approach for defining layouts. For example, modules such as Panels and Layout Builder make use of this API to define layouts that contain regions and that can render content and all sorts of things inside.
We won’t be using layouts going forward in this book but it’s important you know how to work with them in case you need them. So, let’s quickly talk about how you, as a module developer, can define and make use of layouts programmatically.
Defining layouts
Simply put, layouts are plugins. But unlike the plugins we’ve seen before, these are defined in YAML files instead of annotations above a class. One of the reasons for this is that layouts are more definition than functionality, so they don’t necessarily require classes. They can be simply defined in a few lines inside a YAML file.
Although not necessarily...