You are here

function _webform_components_tree_sort in Webform 5.2

Same name and namespace in other branches
  1. 5 webform.module \_webform_components_tree_sort()
  2. 6.3 webform.module \_webform_components_tree_sort()
  3. 6.2 webform.module \_webform_components_tree_sort()
  4. 7.4 webform.module \_webform_components_tree_sort()
  5. 7.3 webform.module \_webform_components_tree_sort()

Sort each level of a component tree by weight and name

1 call to _webform_components_tree_sort()
theme_webform_components_form in ./webform_components.inc
Theme the node components form. Use a table to organize the components.

File

./webform.module, line 2354

Code

function _webform_components_tree_sort($tree) {
  if (isset($tree['children']) && is_array($tree['children'])) {
    $children = array();
    uasort($tree['children'], '_webform_components_sort');
    foreach ($tree['children'] as $cid => $component) {
      $children[$cid] = _webform_components_tree_sort($component);
    }
    $tree['children'] = $children;
  }
  return $tree;
}