You are here

public function PanelsDeleteBlockForm::submitForm in Panels 8.4

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

src/Form/PanelsDeleteBlockForm.php, line 118

Class

PanelsDeleteBlockForm
Provides a form for deleting an access condition.

Namespace

Drupal\panels\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->plugin
    ->removeBlock($this->block
    ->getConfiguration()['uuid']);
  $cached_values = $this
    ->getCachedValues($this->tempstore, $this
    ->getTempstoreId(), $form_state
    ->getValue('block_display'));
  $cached_values['plugin'] = $this->plugin;

  // PageManager specific handling.
  if (isset($cached_values['page_variant'])) {
    $cached_values['page_variant']
      ->getVariantPlugin()
      ->setConfiguration($cached_values['plugin']
      ->getConfiguration());
  }
  $this->tempstore
    ->get($this
    ->getTempstoreId())
    ->set($cached_values['id'], $cached_values);
  $this
    ->messenger()
    ->addMessage($this
    ->t('The block %label has been removed.', [
    '%label' => $this->block
      ->label(),
  ]));
}