function LayoutBuilderDisableForm::submitForm

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

Overrides FormInterface::submitForm

File

core/modules/layout_builder/src/Form/LayoutBuilderDisableForm.php, line 103

Class

LayoutBuilderDisableForm
Disables Layout Builder for a given default.

Namespace

Drupal\layout_builder\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->sectionStorage
        ->disableLayoutBuilder()
        ->save();
    $this->layoutTempstoreRepository
        ->delete($this->sectionStorage);
    $this->messenger()
        ->addMessage($this->t('Layout Builder has been disabled.'));
    $form_state->setRedirectUrl($this->getCancelUrl());
}

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