function layout_builder_entity_type_alter
Same name in other branches
- 8.9.x core/modules/layout_builder/layout_builder.module \layout_builder_entity_type_alter()
- 10 core/modules/layout_builder/layout_builder.module \layout_builder_entity_type_alter()
- 11.x core/modules/layout_builder/layout_builder.module \layout_builder_entity_type_alter()
Implements hook_entity_type_alter().
File
-
core/
modules/ layout_builder/ layout_builder.module, line 71
Code
function layout_builder_entity_type_alter(array &$entity_types) {
/** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
$entity_types['entity_view_display']->setClass(LayoutBuilderEntityViewDisplay::class)
->setStorageClass(LayoutBuilderEntityViewDisplayStorage::class)
->setFormClass('layout_builder', DefaultsEntityForm::class)
->setFormClass('edit', LayoutBuilderEntityViewDisplayForm::class);
// Ensure every fieldable entity type has a layout form.
foreach ($entity_types as $entity_type) {
if ($entity_type->entityClassImplements(FieldableEntityInterface::class)) {
$entity_type->setFormClass('layout_builder', OverridesEntityForm::class);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.