function FormWizardBase::getPreviousParameters

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

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',
    ];
}