function ConfigureBlockFormBase::submitForm

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

Overrides FormInterface::submitForm

File

core/modules/layout_builder/src/Form/ConfigureBlockFormBase.php, line 218

Class

ConfigureBlockFormBase
Provides a base form for configuring a block.

Namespace

Drupal\layout_builder\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    // Call the plugin submit handler.
    $subform_state = SubformState::createForSubform($form['settings'], $form, $form_state);
    $this->getPluginForm($this->block)
        ->submitConfigurationForm($form, $subform_state);
    // If this block is context-aware, set the context mapping.
    if ($this->block instanceof ContextAwarePluginInterface) {
        $this->block
            ->setContextMapping($subform_state->getValue('context_mapping', []));
    }
    $configuration = $this->block
        ->getConfiguration();
    $section = $this->sectionStorage
        ->getSection($this->delta);
    $section->getComponent($this->uuid)
        ->setConfiguration($configuration);
    $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.