summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-11-12 02:59:30 +0000
committerDries Buytaert <dries@buytaert.net>2010-11-12 02:59:30 +0000
commit566c39e7a30014af94a7e8b65dc5cdf5cfb3c6fb (patch)
tree1f81a91d627f81e8b1b859d33a6e3f9980d56e78 /includes
parentfd37414f45cf442b6fdc551c07da1b970ca04691 (diff)
downloadbrdo-566c39e7a30014af94a7e8b65dc5cdf5cfb3c6fb.tar.gz
brdo-566c39e7a30014af94a7e8b65dc5cdf5cfb3c6fb.tar.bz2
- Patch #914792 by sun, moshe weitzman, effulgentsia: custom element properties entirely override default element info properties.
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc18
1 files changed, 18 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 6018eb549..ef6d1b971 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5754,6 +5754,9 @@ function element_sort_by_title($a, $b) {
/**
* Retrieve the default properties for the defined element type.
+ *
+ * @param $type
+ * An element type as defined by hook_element_info().
*/
function element_info($type) {
// Use the advanced drupal_static() pattern, since this is called very often.
@@ -5776,6 +5779,21 @@ function element_info($type) {
}
/**
+ * Retrieve a single property for the defined element type.
+ *
+ * @param $type
+ * An element type as defined by hook_element_info().
+ * @param $property_name
+ * The property within the element type that should be returned.
+ * @param $default
+ * (Optional) The value to return if the element type does not specify a
+ * value for the property. Defaults to NULL.
+ */
+function element_info_property($type, $property_name, $default = NULL) {
+ return (($info = element_info($type)) && array_key_exists($property_name, $info)) ? $info[$property_name] : $default;
+}
+
+/**
* Function used by uasort to sort structured arrays by weight, without the property weight prefix.
*/
function drupal_sort_weight($a, $b) {