You are here

public static function FormsStepsAlter::handle in Forms Steps 8

Handle the form/form_state.

Parameters

array $form: Form to handle.

\Drupal\Core\Form\FormState $form_state: Form State to handle.

1 call to FormsStepsAlter::handle()
forms_steps_form_alter in ./forms_steps.module
Implements hook_form_alter().

File

src/Form/FormsStepsAlter.php, line 25

Class

FormsStepsAlter
Class FormsStepsAlter.

Namespace

Drupal\forms_steps\Form

Code

public static function handle(array &$form, FormState $form_state) {

  /** @var \Drupal\forms_steps\Service\FormsStepsManager $formsStepsManager */
  $formsStepsManager = \Drupal::service('forms_steps.manager');

  /** @var \Drupal\forms_steps\Step $step */
  $step = $formsStepsManager
    ->getStepByRoute(\Drupal::routeMatch()
    ->getRouteName());

  // We define the buttons label.
  FormsStepsAlter::setButtonLabel($step, $form);

  // We manage the previous/next buttons.
  FormsStepsAlter::handleNavigation($step, $form);
}