You are here

function _tagadelic_sort_by_weight in Tagadelic 7

Same name and namespace in other branches
  1. 5 tagadelic.module \_tagadelic_sort_by_weight()
  2. 6 tagadelic.module \_tagadelic_sort_by_weight()

Callback for usort, sort by weight.

1 string reference to '_tagadelic_sort_by_weight'
tagadelic_sort_tags in ./tagadelic.module
API function to order a set of tags.

File

./tagadelic.module, line 307

Code

function _tagadelic_sort_by_weight($a, $b) {
  if ($a->weight == $b->weight) {

    // Ensure correct order when same weight
    return $a->count > $b->count;
  }
  return $a->weight > $b->weight;
}