diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 18 |
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) { |