You are here

function rules_element_sort_helper in Rules 7.2

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 944
Rules User Interface forms.

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;
}