function element_sort
Same name and namespace in other branches
- 6.x drupal-6.x/includes/common.inc \element_sort()
Function used by uasort to sort structured arrays by weight.
1 string reference to 'element_sort'
- element_children in drupal-7.x/
includes/ common.inc - Identifies the children of an element array, optionally sorted by weight.
Archivo
- drupal-7.x/
includes/ common.inc, line 6258 - Common functions that many Drupal modules will need to reference.
Código
function element_sort($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;
}