summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-07-23 21:20:16 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-07-23 21:20:16 +0000
commitdbb5457cfe2fc016b1ab2e3ee0c8585478bb7360 (patch)
treea934f96bee172b3b58af3bf4c8fdda5335ec8db8 /modules/system
parent2a6bd6033de46b447e9c58144668790d45a07896 (diff)
downloadbrdo-dbb5457cfe2fc016b1ab2e3ee0c8585478bb7360.tar.gz
brdo-dbb5457cfe2fc016b1ab2e3ee0c8585478bb7360.tar.bz2
#527804 by sun: Add an alter hook for element_info() to change default values of form elements.
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/system.api.php18
1 files changed, 18 insertions, 0 deletions
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
@@ -116,6 +116,24 @@ function hook_elements() {
}
/**
+ * 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.
*
* This hook is run at the end of each page request. It is often used for