You are here

protected function OverridesEntityForm::init in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Form/OverridesEntityForm.php \Drupal\layout_builder\Form\OverridesEntityForm::init()
  2. 10 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\Form

Code

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);
}