1 file.admin.inc | _file_sort_weight_label($a, $b) |
User sort function to sort by weight, then label/name.
File
- core/
modules/ file/ file.admin.inc, line 680 - Admin page callbacks for the File module.
Code
function _file_sort_weight_label($a, $b) {
$a_weight = isset($a['weight']) ? $a['weight'] : 0;
$b_weight = isset($b['weight']) ? $b['weight'] : 0;
if ($a_weight == $b_weight) {
$a_name = isset($a['name']) ? $a['name'] : '';
$b_name = isset($b['name']) ? $b['name'] : '';
return strcasecmp($a_name, $b_name);
}
else {
return $a_weight < $b_weight ? -1 : 1;
}
}