You are here

protected function WebformUiEntityElementsForm::buildUpdatedElementsRecursive in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_ui/src/WebformUiEntityElementsForm.php \Drupal\webform_ui\WebformUiEntityElementsForm::buildUpdatedElementsRecursive()

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 $webform_ui_elements: 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 WebformUiEntityElementsForm::buildUpdatedElementsRecursive()
WebformUiEntityElementsForm::validateForm in modules/webform_ui/src/WebformUiEntityElementsForm.php
Form validation handler.

File

modules/webform_ui/src/WebformUiEntityElementsForm.php, line 315

Class

WebformUiEntityElementsForm
Webform manage elements UI form.

Namespace

Drupal\webform_ui

Code

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