You are here

function rules_sort_children in Rules 6

Sorts the children of the elements by maintaining the order of the elements if the weight is equal

4 calls to rules_sort_children()
rules_admin_overview_table in rules_admin/rules_admin.inc
Returns a table of rules filtered by the given parameters
rules_admin_rule_proxy::_get_available_variables in rules_admin/rules_admin.rule_proxy.inc
Gets new variables defined by actions in rules, which are evaluated until this rule.
rules_get_rule_set in rules/rules.module
Returns the rule set $set_name, which includes the set info and the rules. To improve performance rule sets are cached.
rules_sort_elements in rules/rules.module
Recursively sorts the elements with rules_sort_children().

File

rules/rules.module, line 348
Rules engine module

Code

function rules_sort_children(&$element) {
  $count = 0;
  foreach (element_children($element) as $key) {
    $element[$key] += array(
      '#weight' => 0,
    );
    $element[$key]['#weight'] += $count / 1000;
    $count++;
  }
  uasort($element, "element_sort");
  foreach (element_children($element) as $key) {
    $element[$key]['#weight'] = floor($element[$key]['#weight']);
  }
}