You are here

public function VariantPluginDeleteBlockForm::submitForm in Page Manager 8.4

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

page_manager_ui/src/Form/VariantPluginDeleteBlockForm.php, line 91

Class

VariantPluginDeleteBlockForm
Provides a form for deleting an access condition.

Namespace

Drupal\page_manager_ui\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->plugin
    ->removeBlock($this->block
    ->getConfiguration()['uuid']);
  $cached_values = $this
    ->getTempstore()
    ->get($form_state
    ->getValue('block_display'));
  $cached_values['plugin'] = $this->plugin;
  $this
    ->getTempstore()
    ->set($form_state
    ->getValue('block_display'), $cached_values);
  $this
    ->messenger()
    ->addMessage($this
    ->t('The block %label has been removed.', [
    '%label' => $this->block
      ->label(),
  ]));
}