You are here

public static function FormsStepsAlter::handleNavigation in Forms Steps 8

Manage previous/next actions.

Parameters

\Drupal\forms_steps\Step $step: Current Step.

array $form: Form to alter.

1 call to FormsStepsAlter::handleNavigation()
FormsStepsAlter::handle in src/Form/FormsStepsAlter.php
Handle the form/form_state.

File

src/Form/FormsStepsAlter.php, line 68

Class

FormsStepsAlter
Class FormsStepsAlter.

Namespace

Drupal\forms_steps\Form

Code

public static function handleNavigation(Step $step, array &$form) {
  if ($step) {
    if ($step
      ->displayPrevious()) {
      $form['actions']['previous'] = [
        '#type' => 'submit',
        '#value' => t($step
          ->previousLabel()),
        '#name' => 'previous_action',
        '#submit' => [
          [
            'Drupal\\forms_steps\\Form\\FormsStepsAlter',
            'setPreviousRoute',
          ],
        ],
        '#limit_validation_errors' => [
          [
            'op',
          ],
        ],
      ];
    }
  }
}