function _webform_components_tree_sort in Webform 7.4
Same name and namespace in other branches
- 5.2 webform.module \_webform_components_tree_sort()
- 5 webform.module \_webform_components_tree_sort()
- 6.3 webform.module \_webform_components_tree_sort()
- 6.2 webform.module \_webform_components_tree_sort()
- 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()
- template_preprocess_webform_components_form in includes/
webform.components.inc - Preprocess variables for theming the webform components form.
File
- ./
webform.module, line 4872 - This module provides a simple way to create forms and questionnaires.
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;
}