You are here

public function PageEditWizard::finish in Page Manager 8

Same name and namespace in other branches
  1. 8.4 page_manager_ui/src/Wizard/PageEditWizard.php \Drupal\page_manager_ui\Wizard\PageEditWizard::finish()

@inheritDoc

Overrides PageWizardBase::finish

File

page_manager_ui/src/Wizard/PageEditWizard.php, line 290
Contains \Drupal\page_manager_ui\Wizard\PageEditWizard.

Class

PageEditWizard

Namespace

Drupal\page_manager_ui\Wizard

Code

public function finish(array &$form, FormStateInterface $form_state) {

  // Delete any of the variants marked for deletion.
  $cached_values = $form_state
    ->getTemporaryValue('wizard');

  /** @var \Drupal\page_manager\Entity\Page $page */
  $page = $cached_values['page'];
  if (!empty($cached_values['deleted_variants'])) {
    foreach (array_keys($cached_values['deleted_variants']) as $page_variant_id) {
      $page
        ->removeVariant($page_variant_id);
    }
  }
  parent::finish($form, $form_state);
}