You are here

function uasort_taxonomy_field_diff_terms in Diff 7.3

Helper function for sorting terms.

1 string reference to 'uasort_taxonomy_field_diff_terms'
taxonomy_field_diff_view in includes/taxonomy.inc
Diff field callback for parsing term field comparative values.

File

includes/taxonomy.inc, line 62
Implements pusdeo-hook hook_field_diff_view() for the Taxonomy module.

Code

function uasort_taxonomy_field_diff_terms($a, $b) {

  // We need to use t() to test for string overrides.
  $missing_text = t('Missing term reference');
  $a_missing = strpos($a, $missing_text) === 0;
  $b_missing = strpos($b, $missing_text) === 0;
  if ($a_missing && $b_missing) {
    return strnatcmp($a, $b);
  }
  elseif ($a_missing xor $b_missing) {
    return $a_missing ? 100 : -100;
  }
  return strnatcmp($a, $b);
}