You are here

public function DefaultsEntityForm::buildForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Form/DefaultsEntityForm.php \Drupal\layout_builder\Form\DefaultsEntityForm::buildForm()
  2. 9 core/modules/layout_builder/src/Form/DefaultsEntityForm.php \Drupal\layout_builder\Form\DefaultsEntityForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides EntityForm::buildForm

File

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

Class

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

Namespace

Drupal\layout_builder\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL) {
  $form['#attributes']['class'][] = 'layout-builder-form';
  $form['layout_builder'] = [
    '#type' => 'layout_builder',
    '#section_storage' => $section_storage,
    '#process' => [
      [
        static::class,
        'layoutBuilderElementGetKeys',
      ],
    ],
  ];
  $form['layout_builder_message'] = $this
    ->buildMessage($section_storage
    ->getContextValue('display'));
  $this->sectionStorage = $section_storage;
  return parent::buildForm($form, $form_state);
}