You are here

function _feeds_tamper_cmp in Feeds Tamper 6

Same name and namespace in other branches
  1. 7 feeds_tamper.inc \_feeds_tamper_cmp()

Comparison callback that sorts by weight, then alphabetically by id.

Related topics

1 string reference to '_feeds_tamper_cmp'
feeds_tamper_load_by_importer in ./feeds_tamper.inc
Load plugin instances by importer id.

File

./feeds_tamper.inc, line 150
Version agnostic parts of feeds_tamper.module.

Code

function _feeds_tamper_cmp($a, $b) {

  // If weights are equal compare id's.
  if ($a->weight == $b->weight) {
    $tmp = array(
      $a->id,
      $b->id,
    );
    sort($tmp);
    if ($tmp[0] == $a->id) {
      return -1;
    }
    return 1;
  }
  return $a->weight < $b->weight ? -1 : 1;
}