From 566c39e7a30014af94a7e8b65dc5cdf5cfb3c6fb Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 12 Nov 2010 02:59:30 +0000 Subject: - Patch #914792 by sun, moshe weitzman, effulgentsia: custom element properties entirely override default element info properties. --- includes/common.inc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'includes') 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. @@ -5775,6 +5778,21 @@ function element_info($type) { return isset($cache[$type]) ? $cache[$type] : array(); } +/** + * 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. */ -- cgit v1.2.3