function FormWizardBase::getPreviousParameters

Same name and namespace in other branches
  1. 4.0.x src/Wizard/FormWizardBase.php \Drupal\ctools\Wizard\FormWizardBase::getPreviousParameters()

The Route parameters for a 'previous' step.

If your route requires more than machine_name and step keys, override and extend this method as needed.

Parameters

mixed $cached_values: The values returned by $this->getTempstore()->get($this->getMachineName());.

Return value

array An array keyed by: machine_name step

Overrides FormWizardInterface::getPreviousParameters

3 calls to FormWizardBase::getPreviousParameters()
FormWizardBase::actions in src/Wizard/FormWizardBase.php
Generates action elements for navigating between the operation steps.
FormWizardBase::ajaxPrevious in src/Wizard/FormWizardBase.php
FormWizardBase::previous in src/Wizard/FormWizardBase.php
Form submit handler to step backwards in the wizard.

File

src/Wizard/FormWizardBase.php, line 216

Class

FormWizardBase
The base class for all form wizard.

Namespace

Drupal\ctools\Wizard

Code

public function getPreviousParameters($cached_values) {
    $operations = $this->getOperations($cached_values);
    $step = $this->getStep($cached_values);
    // Get the steps by key.
    $steps = array_keys($operations);
    // Get the steps before the current step.
    $before = array_slice($operations, 0, array_search($step, $steps));
    // Get the steps before the current step by key.
    $before = array_keys($before);
    // Reverse the steps for easy access to the next step.
    $before_steps = array_reverse($before);
    $step = reset($before_steps);
    return [
        'machine_name' => $this->getMachineName(),
        'step' => $step,
        'js' => 'nojs',
    ];
}