function element_sort
Same name and namespace in other branches
- 7.x drupal-7.x/includes/common.inc \element_sort()
Function used by uasort to sort structured arrays by weight.
2 string references to 'element_sort'
- template_preprocess_user_profile in drupal-6.x/
modules/ user/ user.pages.inc - Process variables for user-profile.tpl.php.
- upload_node_form_submit in drupal-6.x/
modules/ upload/ upload.module - Save new uploads and store them in the session to be associated to the node on upload_save.
Archivo
- drupal-6.x/
includes/ common.inc, line 3067 - 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;
}