You are here

function linkit_profile_sort_weight in Linkit 7.3

Sort profiles by their weight.

1 string reference to 'linkit_profile_sort_weight'
linkit_profile_load_all in ./linkit.module
Load all Linkit profiles.

File

./linkit.module, line 148
Main file for Linkit module.

Code

function linkit_profile_sort_weight($a, $b) {
  $a_weight = isset($a->weight) ? $a->weight : 0;
  $b_weight = isset($b->weight) ? $b->weight : 0;
  if ($a_weight == $b_weight) {

    // If the weight is the same, sort by name.
    return strcmp($a->name, $b->name);
  }
  return $a_weight < $b_weight ? -1 : 1;
}