function OverridesEntityForm::buildForm

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

Overrides EntityForm::buildForm

File

core/modules/layout_builder/src/Form/OverridesEntityForm.php, line 97

Class

OverridesEntityForm
Provides a form containing the Layout Builder UI for overrides.

Namespace

Drupal\layout_builder\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL) {
    $this->sectionStorage = $section_storage;
    $form = parent::buildForm($form, $form_state);
    $form['#attributes']['class'][] = 'layout-builder-form';
    // @todo \Drupal\layout_builder\Field\LayoutSectionItemList::defaultAccess()
    //   restricts all access to the field, explicitly allow access here until
    //   https://www.drupal.org/node/2942975 is resolved.
    $form[OverridesSectionStorage::FIELD_NAME]['#access'] = TRUE;
    $form['layout_builder_message'] = $this->buildMessage($section_storage->getContextValue('entity'), $section_storage);
    return $form;
}

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