function _filefield_sort_by_weight_helper in FileField 6.2
Sort function for file formatter/widget order. (copied form element_sort(), which acts on #weight keys)
1 string reference to '_filefield_sort_by_weight_helper'
- _filefield_sort_by_weight in ./
filefield.module - Helper function to sort file formatter/widget settings according to user drag-n-drop reordering.
File
- ./
filefield.module, line 735
Code
function _filefield_sort_by_weight_helper($a, $b) {
$a_weight = is_array($a) && isset($a['weight']) ? $a['weight'] : 0;
$b_weight = is_array($b) && isset($b['weight']) ? $b['weight'] : 0;
if ($a_weight == $b_weight) {
return 0;
}
return $a_weight < $b_weight ? -1 : 1;
}