You are here

public function StaticContextDeleteForm::submitForm in Page Manager 8.4

Same name and namespace in other branches
  1. 8 page_manager_ui/src/Form/StaticContextDeleteForm.php \Drupal\page_manager_ui\Form\StaticContextDeleteForm::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/StaticContextDeleteForm.php, line 72

Class

StaticContextDeleteForm
Provides a form for deleting an access condition.

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