You are here

public function FormStep::getStepValues in Simple multi step form 8

Same name and namespace in other branches
  1. 8.x src/FormStep.php \Drupal\simple_multistep\FormStep::getStepValues()

Get submission values for current step.

Parameters

object $step: Step option.

Return value

array Array with step values.

1 call to FormStep::getStepValues()
MultistepController::saveStoredValues in src/MultistepController.php
Save stored values from current step.

File

src/FormStep.php, line 195

Class

FormStep
Class FormStep.

Namespace

Drupal\simple_multistep

Code

public function getStepValues($step) {
  $list_value = [];
  $all_children = $this
    ->getAllChildren($step);
  $current_user_input = $this->formState
    ->getValues();
  if (in_array('account', $all_children)) {
    $all_children = array_merge($all_children, [
      'name',
      'pass',
      'mail',
    ]);
  }
  foreach ($all_children as $field_name) {
    if (isset($current_user_input[$field_name])) {
      $list_value[$field_name] = $current_user_input[$field_name];
    }
  }
  return $list_value;
}