protected function OverridesEntityForm::init in Drupal 9
Same name and namespace in other branches
- 8 core/modules/layout_builder/src/Form/OverridesEntityForm.php \Drupal\layout_builder\Form\OverridesEntityForm::init()
Initializes the form state and the entity before the first form build.
Parameters
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides ContentEntityForm::init
File
- core/
modules/ layout_builder/ src/ Form/ OverridesEntityForm.php, line 81
Class
- OverridesEntityForm
- Provides a form containing the Layout Builder UI for overrides.
Namespace
Drupal\layout_builder\FormCode
protected function init(FormStateInterface $form_state) {
parent::init($form_state);
$form_display = EntityFormDisplay::collectRenderDisplay($this->entity, $this
->getOperation(), FALSE);
$form_display
->setComponent(OverridesSectionStorage::FIELD_NAME, [
'type' => 'layout_builder_widget',
'weight' => -10,
'settings' => [],
]);
$this
->setFormDisplay($form_display, $form_state);
}