summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJennifer Hodgdon <yahgrp@poplarware.com>2012-07-31 08:32:04 -0700
committerJennifer Hodgdon <yahgrp@poplarware.com>2012-07-31 08:32:04 -0700
commit155e77fd080792d161d6b39f31ad3e9bda13ba14 (patch)
tree01a646f2dbbde00e420095b2ec0d237d0cb19c26
parent5520fb410595427721ed0a1dd80e98df4ede6da4 (diff)
downloadbrdo-155e77fd080792d161d6b39f31ad3e9bda13ba14.tar.gz
brdo-155e77fd080792d161d6b39f31ad3e9bda13ba14.tar.bz2
Issue #1673380 by marcin.wosinek: Fix docs for drupal_sort_weight function
-rw-r--r--includes/common.inc14
1 files changed, 13 insertions, 1 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 051efd55a..f80496bf8 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -6219,7 +6219,19 @@ function element_info_property($type, $property_name, $default = NULL) {
}
/**
- * Function used by uasort to sort structured arrays by weight, without the property weight prefix.
+ * Sorts a structured array by the 'weight' element.
+ *
+ * Note that the sorting is by the 'weight' array element, not by the render
+ * element property '#weight'.
+ *
+ * Callback for uasort() used in various functions.
+ *
+ * @param $a
+ * First item for comparison. The compared items should be associative arrays
+ * that optionally include a 'weight' element. For items without a 'weight'
+ * element, a default value of 0 will be used.
+ * @param $b
+ * Second item for comparison.
*/
function drupal_sort_weight($a, $b) {
$a_weight = (is_array($a) && isset($a['weight'])) ? $a['weight'] : 0;