function DefaultsEntityForm::buildEntity

Same name in other branches
  1. 9 core/modules/layout_builder/src/Form/DefaultsEntityForm.php \Drupal\layout_builder\Form\DefaultsEntityForm::buildEntity()
  2. 8.9.x core/modules/layout_builder/src/Form/DefaultsEntityForm.php \Drupal\layout_builder\Form\DefaultsEntityForm::buildEntity()
  3. 11.x core/modules/layout_builder/src/Form/DefaultsEntityForm.php \Drupal\layout_builder\Form\DefaultsEntityForm::buildEntity()

Overrides EntityForm::buildEntity

File

core/modules/layout_builder/src/Form/DefaultsEntityForm.php, line 129

Class

DefaultsEntityForm
Provides a form containing the Layout Builder UI for defaults.

Namespace

Drupal\layout_builder\Form

Code

public function buildEntity(array $form, FormStateInterface $form_state) {
    // \Drupal\Core\Entity\EntityForm::buildEntity() clones the entity object.
    // Keep it in sync with the one used by the section storage.
    $this->setEntity($this->sectionStorage
        ->getContextValue('display'));
    $entity = parent::buildEntity($form, $form_state);
    $this->sectionStorage
        ->setContextValue('display', $entity);
    return $entity;
}

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