You are here

public function ConfigureSectionForm::submitForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Form/ConfigureSectionForm.php \Drupal\layout_builder\Form\ConfigureSectionForm::submitForm()

Form submission handler.

Parameters

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

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

Overrides FormInterface::submitForm

File

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

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);
  $plugin_id = $this->layout
    ->getPluginId();
  $configuration = $this->layout
    ->getConfiguration();
  if ($this->isUpdate) {
    $this->sectionStorage
      ->getSection($this->delta)
      ->setLayoutSettings($configuration);
  }
  else {
    $this->sectionStorage
      ->insertSection($this->delta, new Section($plugin_id, $configuration));
  }
  $this->layoutTempstoreRepository
    ->set($this->sectionStorage);
  $form_state
    ->setRedirectUrl($this->sectionStorage
    ->getLayoutBuilderUrl());
}