1 redirect.module | _redirect_uasort($a, $b) |
uasort callback; Compare redirects based on language neutrality and rids.
File
- core/
modules/ redirect/ redirect.module, line 1269
Code
function _redirect_uasort($a, $b) {
$a_weight = isset($a->weight) ? $a->weight : 0;
$b_weight = isset($b->weight) ? $b->weight : 0;
if ($a_weight != $b_weight) {
// First sort by weight (case sensitivity).
return $a_weight > $b_weight;
}
elseif ($a->langcode != $b->langcode) {
// Then sort by language specific over language neutral.
return $a->langcode == LANGUAGE_NONE;
}
elseif (!empty($a->source_options['query']) != !empty($b->source_options['query'])) {
// Then sort by redirects that do not have query strings over ones that do.
return empty($a->source_options['query']);
}
else {
// Lastly sort by the highest redirect ID.
return $a->rid < $b->rid;
}
}