You are here

public function PanelizerDefaultDelete::submitForm in Panelizer 8.4

Same name and namespace in other branches
  1. 8.5 src/Form/PanelizerDefaultDelete.php \Drupal\panelizer\Form\PanelizerDefaultDelete::submitForm()
  2. 8.3 src/Form/PanelizerDefaultDelete.php \Drupal\panelizer\Form\PanelizerDefaultDelete::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/PanelizerDefaultDelete.php, line 156

Class

PanelizerDefaultDelete

Namespace

Drupal\panelizer\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $display = $this->panelizer
    ->getEntityViewDisplay($this->entityTypeId, $this->bundle, $this->viewMode);
  $displays = $this->panelizer
    ->getDefaultPanelsDisplays($this->entityTypeId, $this->bundle, $this->viewMode, $display);
  unset($displays[$this->displayId]);
  foreach ($displays as $key => $value) {
    $displays[$key] = $this->panelsDisplayManager
      ->exportDisplay($value);
  }
  $display
    ->setThirdPartySetting('panelizer', 'displays', $displays);
  $display
    ->save();
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
  $tag = "panelizer_default:{$this->entityTypeId}:{$this->bundle}:{$this->viewMode}:{$this->displayId}";
  $this->invalidator
    ->invalidateTags([
    $tag,
  ]);
}