You are here

public function PanelizerDefaultSelect::submitForm in Panelizer 8.3

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

Class

PanelizerDefaultSelect

Namespace

Drupal\panelizer\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $display = $this->panelizer
    ->getEntityViewDisplay($this->entityTypeId, $this->bundle, $this->viewMode);
  $settings = $this->panelizer
    ->getPanelizerSettings($this->entityTypeId, $this->bundle, $this->viewMode, $display);
  $settings['default'] = $this->displayId;
  $this->panelizer
    ->setPanelizerSettings($this->entityTypeId, $this->bundle, $this->viewMode, $settings, $display);
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
  $tag = "panelizer_default:{$this->entityTypeId}:{$this->bundle}:{$this->viewMode}";
  $this->invalidator
    ->invalidateTags([
    $tag,
  ]);
}