You are here

public function PageWizardBase::finish in Page Manager 8

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

Form submit handler for finalizing the wizard values.

If you need to generate an entity or save config or raw table data subsequent to your form wizard, this is the responsible method.

Parameters

array $form: Drupal form array.

\Drupal\Core\Form\FormStateInterface $form_state: The final form state of the wizard.

Overrides EntityFormWizardBase::finish

1 call to PageWizardBase::finish()
PageEditWizard::finish in page_manager_ui/src/Wizard/PageEditWizard.php
@inheritDoc
1 method overrides PageWizardBase::finish()
PageEditWizard::finish in page_manager_ui/src/Wizard/PageEditWizard.php
@inheritDoc

File

page_manager_ui/src/Wizard/PageWizardBase.php, line 101
Contains \Drupal\page_manager_ui\Wizard\PageWizardBase.

Class

PageWizardBase

Namespace

Drupal\page_manager_ui\Wizard

Code

public function finish(array &$form, FormStateInterface $form_state) {
  parent::finish($form, $form_state);
  $cached_values = $form_state
    ->getTemporaryValue('wizard');

  /** @var \Drupal\page_manager\Entity\Page $page */
  $page = $cached_values['page'];
  foreach ($page
    ->getVariants() as $variant) {
    $variant
      ->save();
  }
  $form_state
    ->setRedirectUrl(new Url('entity.page.edit_form', [
    'machine_name' => $this->machine_name,
    'step' => $this->step,
  ]));
}