UPDATE: This hook has been removed, an update on how to add elements to the layout builder form can be found here.
The layout builder per-entity layout overrides form has been updated to be an entity form, instead of a route and controller. The entity form is built using an EntityFormDisplay
object, which is passed to an alter hook (but never saved or persisted in the database). This allows other modules which may want to integrate with layout builder a chance to add a component to the form.
An example of this might be a module enabling the publishing checkbox on the layout builder form:
/**
* Implements hook_layout_builder_overrides_entity_form_display_alter().
*/
function EXAMPLE_layout_builder_overrides_entity_form_display_alter(\Drupal\Core\Entity\Display\EntityFormDisplayInterface $display) {
$display->setComponent('status', [
'type' => 'boolean_checkbox',
'settings' => [
'display_label' => TRUE,
],
]);
}
This was introduced to unblock work related to allowing users to optionally create a new revision when managing a layout and to enable draft layouts via integration with the Content Moderation module.