function ConfigureSectionForm::submitForm

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

Overrides FormInterface::submitForm

File

core/modules/layout_builder/src/Form/ConfigureSectionForm.php, line 187

Class

ConfigureSectionForm
Provides a form for configuring a layout section.

Namespace

Drupal\layout_builder\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    // Call the plugin submit handler.
    $subform_state = SubformState::createForSubform($form['layout_settings'], $form, $form_state);
    $this->getPluginForm($this->layout)
        ->submitConfigurationForm($form['layout_settings'], $subform_state);
    // If this layout is context-aware, set the context mapping.
    if ($this->layout instanceof ContextAwarePluginInterface) {
        $this->layout
            ->setContextMapping($subform_state->getValue('context_mapping', []));
    }
    $configuration = $this->layout
        ->getConfiguration();
    $section = $this->getCurrentSection();
    $section->setLayoutSettings($configuration);
    if (!$this->isUpdate) {
        $this->sectionStorage
            ->insertSection($this->delta, $section);
    }
    $this->layoutTempstoreRepository
        ->set($this->sectionStorage);
    $form_state->setRedirectUrl($this->sectionStorage
        ->getLayoutBuilderUrl());
}

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