function LayoutForm::buildForm

Same name and namespace in other branches
  1. 10 core/modules/navigation/src/Form/LayoutForm.php \Drupal\navigation\Form\LayoutForm::buildForm()

Overrides FormInterface::buildForm

File

core/modules/navigation/src/Form/LayoutForm.php, line 66

Class

LayoutForm
Defines a form for configuring navigation blocks.

Namespace

Drupal\navigation\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,
    ];
    $form['#attached']['library'][] = 'navigation/navigation.layoutBuilder';
    $this->sectionStorage = $section_storage;
    $form['actions'] = [
        'submit' => [
            '#type' => 'submit',
            '#value' => $this->t('Save'),
        ],
    ] + $this->buildActionsElement([]);
    return $form;
}

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