You are here

public function PageVariantConfigureForm::submitForm in Page Manager 8.4

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

page_manager_ui/src/Form/PageVariantConfigureForm.php, line 76

Class

PageVariantConfigureForm

Namespace

Drupal\page_manager_ui\Form

Code

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

  /** @var $page \Drupal\page_manager\Entity\Page */
  $page = $cached_values['page'];

  /** @var $page_variant \Drupal\page_manager\Entity\PageVariant */
  $page_variant = $cached_values['page_variant'];
  $variant_plugin = $page_variant
    ->getVariantPlugin();
  $variant_plugin
    ->submitConfigurationForm($form['variant_settings'], (new FormState())
    ->setValues($form_state
    ->getValue('variant_settings', [])));
  $configuration = $variant_plugin
    ->getConfiguration();
  $page_variant
    ->set('variant_settings', $configuration);
  $page_variant
    ->set('label', $form_state
    ->getValue('page_variant_label'));
}