You are here

public function LayoutBuilderDisableForm::submitForm in Drupal 9

Same name and namespace in other branches
  1. 8 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()

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/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());
}