You are here

function og_vocab_sort_weight in OG Vocabulary 7

Sorts a structured array by the 'weight' element, and if they are equal then by the vocabylary ID.

Parameters

$a: First item for comparison.

$b: Second item for comparison.

See also

drupal_sort_weight()

1 string reference to 'og_vocab_sort_weight'
og_vocab_field_formatter_view in ./og_vocab.module
Implements hook_field_formatter_view().

File

./og_vocab.module, line 711
Give each group its own system controlled vocabularies.

Code

function og_vocab_sort_weight($a, $b) {
  $result = drupal_sort_weight($a, $b);
  if ($result !== 0) {
    return $result;
  }

  // Sort by the vocabulary ID.
  return $a['vid'] < $b['vid'] ? -1 : 1;
}