function rules_element_sort_helper

Helper to sort elements by their 'weight' key.

1 string reference to 'rules_element_sort_helper'
RulesPluginUI::settingsFormExtractValues in ui/ui.core.inc

File

ui/ui.forms.inc, line 946

Code

function rules_element_sort_helper($a, $b) {
  $a += array(
    'weight' => 0,
  );
  $b += array(
    'weight' => 0,
  );
  if ($a['weight'] == $b['weight']) {
    return 0;
  }
  return $a['weight'] < $b['weight'] ? -1 : 1;
}