public function LayoutBuilderEntityViewDisplayForm::entityFormEntityBuild in Drupal 9
Same name and namespace in other branches
- 8 core/modules/layout_builder/src/Form/LayoutBuilderEntityViewDisplayForm.php \Drupal\layout_builder\Form\LayoutBuilderEntityViewDisplayForm::entityFormEntityBuild()
- 10 core/modules/layout_builder/src/Form/LayoutBuilderEntityViewDisplayForm.php \Drupal\layout_builder\Form\LayoutBuilderEntityViewDisplayForm::entityFormEntityBuild()
Entity builder for layout options on the entity view display form.
File
- core/
modules/ layout_builder/ src/ Form/ LayoutBuilderEntityViewDisplayForm.php, line 200
Class
- LayoutBuilderEntityViewDisplayForm
- Edit form for the LayoutBuilderEntityViewDisplay entity type.
Namespace
Drupal\layout_builder\FormCode
public function entityFormEntityBuild($entity_type_id, LayoutEntityDisplayInterface $display, &$form, FormStateInterface &$form_state) {
$set_enabled = (bool) $form_state
->getValue([
'layout',
'enabled',
], FALSE);
$already_enabled = $display
->isLayoutBuilderEnabled();
if ($set_enabled) {
$overridable = (bool) $form_state
->getValue([
'layout',
'allow_custom',
], FALSE);
$display
->setOverridable($overridable);
if (!$already_enabled) {
$display
->enableLayoutBuilder();
}
}
elseif ($already_enabled) {
$form_state
->setRedirectUrl($this->sectionStorage
->getLayoutBuilderUrl('disable'));
}
}