You are here

public function AddVariantStaticContextDeleteForm::submitForm in Page Manager 8.4

Same name and namespace in other branches
  1. 8 page_manager_ui/src/Form/AddVariantStaticContextDeleteForm.php \Drupal\page_manager_ui\Form\AddVariantStaticContextDeleteForm::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 ContextDelete::submitForm

File

page_manager_ui/src/Form/AddVariantStaticContextDeleteForm.php, line 44

Class

AddVariantStaticContextDeleteForm

Namespace

Drupal\page_manager_ui\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $cached_values = $this
    ->getTempstore();

  /** @var $page \Drupal\page_manager\PageInterface */
  $page_variant = $this
    ->getPageVariant($cached_values);
  $this
    ->messenger()
    ->addMessage($this
    ->t('The static context %label has been removed.', [
    '%label' => $page_variant
      ->getStaticContext($this->context_id)['label'],
  ]));
  $page_variant
    ->removeStaticContext($this->context_id);
  $this
    ->setTempstore($cached_values);
  parent::submitForm($form, $form_state);
}