From dbb5457cfe2fc016b1ab2e3ee0c8585478bb7360 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Thu, 23 Jul 2009 21:20:16 +0000 Subject: #527804 by sun: Add an alter hook for element_info() to change default values of form elements. --- modules/system/system.api.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'modules/system/system.api.php') diff --git a/modules/system/system.api.php b/modules/system/system.api.php index 7aead6c9b..8986270b2 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -115,6 +115,24 @@ function hook_elements() { return $type; } +/** + * Alter the element type information returned from modules. + * + * A module may implement this hook in order to alter the element type defaults + * defined by a module. + * + * @param &$type + * All element type defaults as collected by hook_elements(). + * + * @see hook_elements() + */ +function hook_element_info_alter(&$type) { + // Decrease the default size of textfields. + if (isset($type['textfield']['#size'])) { + $type['textfield']['#size'] = 40; + } +} + /** * Perform cleanup tasks. * -- cgit v1.2.3