You are here

public function DiscardLayoutChangesForm::submitForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Form/DiscardLayoutChangesForm.php \Drupal\layout_builder\Form\DiscardLayoutChangesForm::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/DiscardLayoutChangesForm.php, line 98

Class

DiscardLayoutChangesForm
Discards any pending changes to the layout.

Namespace

Drupal\layout_builder\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->layoutTempstoreRepository
    ->delete($this->sectionStorage);
  $this->messenger
    ->addMessage($this
    ->t('The changes to the layout have been discarded.'));
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
}