You are here

public static function FormsStepsAlter::setButtonLabel in Forms Steps 8

Define the submit and cancel label using the step configuration.

Parameters

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

array $form: Form to alter.

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

File

src/Form/FormsStepsAlter.php, line 48

Class

FormsStepsAlter
Class FormsStepsAlter.

Namespace

Drupal\forms_steps\Form

Code

public static function setButtonLabel(Step $step, array &$form) {
  if ($step) {
    if ($step
      ->submitLabel()) {
      $form['actions']['submit']['#value'] = t($step
        ->submitLabel());
    }
    if ($step
      ->cancelLabel()) {
      $form['actions']['cancel']['#value'] = t($step
        ->cancelLabel());
    }
  }
}