function OverridesEntityForm::init

Same name in other branches
  1. 8.9.x 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()
  3. 11.x core/modules/layout_builder/src/Form/OverridesEntityForm.php \Drupal\layout_builder\Form\OverridesEntityForm::init()

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.