You are here

protected function FormBase::indexElements in Form Builder 7.2

Add the element and it's subelements to the elementd index.

The index is stored in $this->elementArrays and used by all element_id based methods.

3 calls to FormBase::indexElements()
FormBase::setElementArray in src/FormBase.php
(@inheritdoc}
FormBase::unserialize in src/FormBase.php
Unserialize a stored version of this form.
FormBase::__construct in src/FormBase.php

File

src/FormBase.php, line 198

Class

FormBase

Namespace

Drupal\form_builder

Code

protected function indexElements(&$element) {
  if (isset($element['#form_builder']['element_id'])) {
    $element_id = $element['#form_builder']['element_id'];
    $this->elementArrays[$element_id] =& $element;
  }
  foreach (element_children($element) as $key) {
    $this
      ->indexElements($element[$key]);
  }
}