You are here

public function FormBase::unsetElement in Form Builder 7.2

File

src/FormBase.php, line 328

Class

FormBase

Namespace

Drupal\form_builder

Code

public function unsetElement($element_id) {
  $element = $this->elementArrays[$element_id];
  foreach (element_children($element) as $key) {
    if (!empty($element[$key]['#form_builder']['element_id'])) {
      $this
        ->unsetElement($element[$key]['#form_builder']['element_id']);
    }
  }
  unset($this->elementArrays[$element_id]);
  $parent =& $this->elementArrays[$element['#form_builder']['parent_id']];
  unset($parent[$element['#key']]);
}