You are here

protected function YamlFormUiEntityForm::buildUpdatedElementsRecursive in YAML Form 8

Build updated elements using the new parent child relationship.

Parameters

array $elements: An associative array that will be populated with updated elements hierarchy.

string $key: The current element key. The blank empty key represents the elements root.

array $elements_reordered: An associative array contain the reordered elements parent child relationship.

array $elements_flattened: An associative array containing the raw flattened elements that will copied into the updated elements hierarchy.

1 call to YamlFormUiEntityForm::buildUpdatedElementsRecursive()
YamlFormUiEntityForm::validateForm in modules/yamlform_ui/src/YamlFormUiEntityForm.php
Form validation handler.

File

modules/yamlform_ui/src/YamlFormUiEntityForm.php, line 376

Class

YamlFormUiEntityForm
Base for controller for form UI.

Namespace

Drupal\yamlform_ui

Code

protected function buildUpdatedElementsRecursive(array &$elements, $key, array $elements_reordered, array $elements_flattened) {
  if (!isset($elements_reordered[$key]['children'])) {
    return;
  }
  foreach ($elements_reordered[$key]['children'] as $key) {
    $elements[$key] = $elements_flattened[$key];
    $this
      ->buildUpdatedElementsRecursive($elements[$key], $key, $elements_reordered, $elements_flattened);
  }
}