You are here

protected function FormStep::getAllChildren in Simple multi step form 8.x

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

Get all child from field group.

Parameters

object $fieldgroup: Field group object.

array $child: Array with existing child.

Return value

array Return array with child.

2 calls to FormStep::getAllChildren()
FormStep::getStepValues in src/FormStep.php
Get submission values for current step.
MultistepController::rebuildForm in src/MultistepController.php
Prepare Multistep Form.

File

src/FormStep.php, line 218

Class

FormStep
Class FormStep.

Namespace

Drupal\simple_multistep

Code

protected function getAllChildren($fieldgroup, array $child = []) {
  if ($group_children = $fieldgroup->children) {
    foreach ($group_children as $form_element_id) {
      if (isset($this->form[$form_element_id])) {
        $child[] = $form_element_id;
      }
      elseif (isset($this->form['#fieldgroups'][$form_element_id]->children)) {
        $child = $this
          ->getAllChildren($this->form['#fieldgroups'][$form_element_id], $child);
      }
    }
  }
  return $child;
}