You are here

protected function FormStep::fetchSteps in Simple multi step form 8

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

Get array with form steps.

1 call to FormStep::fetchSteps()
FormStep::updateStepInfo in src/FormStep.php
Update step info.

File

src/FormStep.php, line 120

Class

FormStep
Class FormStep.

Namespace

Drupal\simple_multistep

Code

protected function fetchSteps() {
  $steps = [];
  if (isset($this->form['#fieldgroups']) && is_array($this->form['#fieldgroups'])) {
    foreach ($this->form['#fieldgroups'] as $field_group) {
      if ($field_group->format_type == 'form_step') {
        $steps[] = $field_group;
      }
    }
    usort($steps, [
      $this,
      'sortStep',
    ]);
  }
  $this->steps = $steps;
}