You are here

protected function PageEditWizard::getVariantOperations 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::getVariantOperations()

Get operations for the variant.

@returns array

Parameters

\Drupal\page_manager\PageVariantInterface $page_variant: The page variant entity.

mixed $cached_values: The cached values.

1 call to PageEditWizard::getVariantOperations()
PageEditWizard::getOperations in page_manager_ui/src/Wizard/PageEditWizard.php
Retrieve a list of FormInterface classes by their step key in the wizard.

File

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

Class

PageEditWizard

Namespace

Drupal\page_manager_ui\Wizard

Code

protected function getVariantOperations(PageVariantInterface $page_variant, $cached_values) {
  $operations = [];
  $operations['general'] = [
    'title' => $this
      ->t('General'),
    'form' => PageVariantConfigureForm::class,
  ];
  $operations['contexts'] = [
    'title' => $this
      ->t('Contexts'),
    'form' => PageVariantContextsForm::class,
  ];
  $operations['selection'] = [
    'title' => $this
      ->t('Selection criteria'),
    'form' => PageVariantSelectionForm::class,
  ];

  // Add any wizard operations from the plugin itself.
  $variant_plugin = $page_variant
    ->getVariantPlugin();
  if ($variant_plugin instanceof PluginWizardInterface) {
    if ($variant_plugin instanceof ContextAwareVariantInterface) {
      $variant_plugin
        ->setContexts($page_variant
        ->getContexts());
    }
    $cached_values['plugin'] = $variant_plugin;
    foreach ($variant_plugin
      ->getWizardOperations($cached_values) as $name => $operation) {
      $operation['values']['plugin'] = $variant_plugin;
      $operation['submit'][] = '::submitVariantStep';
      $operations[$name] = $operation;
    }
  }
  return $operations;
}