summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-09-10 06:31:39 +0000
committerDries Buytaert <dries@buytaert.net>2009-09-10 06:31:39 +0000
commitd481f1cd364de615d274c2ccde68e37126f1959e (patch)
treebb4c488f30b310441fb81ef76f0edbad382cd3f0 /modules/system
parent46c4a33b21988a5420ffab0964c6a017abbb96b2 (diff)
downloadbrdo-d481f1cd364de615d274c2ccde68e37126f1959e.tar.gz
brdo-d481f1cd364de615d274c2ccde68e37126f1959e.tar.bz2
- Patch #572932 by sun: rename hook_elements() to hook_elements_info() for consistency. Yay to API clean-ups during 'slush'.
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/system.api.php15
-rw-r--r--modules/system/system.module93
2 files changed, 43 insertions, 65 deletions
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 4f2ec074b..2c5bcbd27 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -215,10 +215,15 @@ function hook_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
* - "#pre_render": array of callback functions taking $element and $form_state.
* - "#post_render": array of callback functions taking $element and $form_state.
* - "#submit": array of callback functions taking $form and $form_state.
+ *
+ * @see hook_element_info_alter()
+ * @see system_element_info()
*/
-function hook_elements() {
- $type['filter_format'] = array('#input' => TRUE);
- return $type;
+function hook_element_info() {
+ $types['filter_format'] = array(
+ '#input' => TRUE,
+ );
+ return $types;
}
/**
@@ -228,9 +233,9 @@ function hook_elements() {
* defined by a module.
*
* @param &$type
- * All element type defaults as collected by hook_elements().
+ * All element type defaults as collected by hook_element_info().
*
- * @see hook_elements()
+ * @see hook_element_info()
*/
function hook_element_info_alter(&$type) {
// Decrease the default size of textfields.
diff --git a/modules/system/system.module b/modules/system/system.module
index e0762d993..ff4cf4ed3 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -279,32 +279,28 @@ function system_entity_info() {
}
/**
- * Implement hook_elements().
+ * Implement hook_element_info().
*/
-function system_elements() {
- // Top level form
- $type['form'] = array(
+function system_element_info() {
+ // Top level elements.
+ $types['form'] = array(
'#method' => 'post',
'#action' => request_uri(),
'#theme_wrappers' => array('form'),
);
-
- $type['page'] = array(
+ $types['page'] = array(
'#show_messages' => TRUE,
'#theme' => 'page',
);
-
- $type['list'] = array(
+ $types['list'] = array(
'#title' => '',
'#list_type' => 'ul',
'#attributes' => array(),
'#items' => array(),
);
- /**
- * Input elements.
- */
- $type['submit'] = array(
+ // Input elements.
+ $types['submit'] = array(
'#input' => TRUE,
'#name' => 'op',
'#button_type' => 'submit',
@@ -312,8 +308,7 @@ function system_elements() {
'#process' => array('ajax_process_form'),
'#theme_wrappers' => array('button'),
);
-
- $type['button'] = array(
+ $types['button'] = array(
'#input' => TRUE,
'#name' => 'op',
'#button_type' => 'submit',
@@ -321,8 +316,7 @@ function system_elements() {
'#process' => array('ajax_process_form'),
'#theme_wrappers' => array('button'),
);
-
- $type['image_button'] = array(
+ $types['image_button'] = array(
'#input' => TRUE,
'#button_type' => 'submit',
'#executes_submit_callback' => TRUE,
@@ -332,8 +326,7 @@ function system_elements() {
'#src' => NULL,
'#theme_wrappers' => array('image_button'),
);
-
- $type['textfield'] = array(
+ $types['textfield'] = array(
'#input' => TRUE,
'#size' => 60,
'#maxlength' => 128,
@@ -342,8 +335,7 @@ function system_elements() {
'#theme' => 'textfield',
'#theme_wrappers' => array('form_element'),
);
-
- $type['password'] = array(
+ $types['password'] = array(
'#input' => TRUE,
'#size' => 60,
'#maxlength' => 128,
@@ -351,14 +343,12 @@ function system_elements() {
'#theme' => 'password',
'#theme_wrappers' => array('form_element'),
);
-
- $type['password_confirm'] = array(
+ $types['password_confirm'] = array(
'#input' => TRUE,
'#process' => array('form_process_password_confirm'),
'#theme_wrappers' => array('form_element'),
);
-
- $type['textarea'] = array(
+ $types['textarea'] = array(
'#input' => TRUE,
'#cols' => 60,
'#rows' => 5,
@@ -367,15 +357,13 @@ function system_elements() {
'#theme' => 'textarea',
'#theme_wrappers' => array('form_element'),
);
-
- $type['radios'] = array(
+ $types['radios'] = array(
'#input' => TRUE,
'#process' => array('form_process_radios'),
'#theme_wrappers' => array('radios'),
'#pre_render' => array('form_pre_render_conditional_form_element'),
);
-
- $type['radio'] = array(
+ $types['radio'] = array(
'#input' => TRUE,
'#default_value' => NULL,
'#process' => array('ajax_process_form'),
@@ -383,16 +371,14 @@ function system_elements() {
'#theme_wrappers' => array('form_element'),
'#form_element_skip_title' => TRUE,
);
-
- $type['checkboxes'] = array(
+ $types['checkboxes'] = array(
'#input' => TRUE,
'#tree' => TRUE,
'#process' => array('form_process_checkboxes'),
'#theme_wrappers' => array('checkboxes'),
'#pre_render' => array('form_pre_render_conditional_form_element'),
);
-
- $type['checkbox'] = array(
+ $types['checkbox'] = array(
'#input' => TRUE,
'#return_value' => 1,
'#process' => array('ajax_process_form'),
@@ -400,8 +386,7 @@ function system_elements() {
'#theme_wrappers' => array('form_element'),
'#form_element_skip_title' => TRUE,
);
-
- $type['select'] = array(
+ $types['select'] = array(
'#input' => TRUE,
'#size' => 0,
'#multiple' => FALSE,
@@ -409,64 +394,54 @@ function system_elements() {
'#theme' => 'select',
'#theme_wrappers' => array('form_element'),
);
-
- $type['weight'] = array(
+ $types['weight'] = array(
'#input' => TRUE,
'#delta' => 10,
'#default_value' => 0,
'#process' => array('form_process_weight', 'ajax_process_form'),
);
-
- $type['date'] = array(
+ $types['date'] = array(
'#input' => TRUE,
'#element_validate' => array('date_validate'),
'#process' => array('form_process_date'),
'#theme' => 'date',
'#theme_wrappers' => array('form_element'),
);
-
- $type['file'] = array(
+ $types['file'] = array(
'#input' => TRUE,
'#size' => 60,
'#theme' => 'file',
'#theme_wrappers' => array('form_element'),
);
-
- $type['tableselect'] = array(
+ $types['tableselect'] = array(
'#input' => TRUE,
'#js_select' => TRUE,
'#multiple' => TRUE,
'#process' => array('form_process_tableselect'),
'#options' => array(),
'#empty' => '',
- '#theme' => 'tableselect'
+ '#theme' => 'tableselect',
);
- /**
- * Form structure.
- */
- $type['item'] = array(
+ // Form structure.
+ $types['item'] = array(
'#markup' => '',
'#theme' => 'markup',
'#theme_wrappers' => array('form_element'),
);
-
- $type['hidden'] = array(
+ $types['hidden'] = array(
'#input' => TRUE,
'#process' => array('ajax_process_form'),
'#theme' => 'hidden',
);
-
- $type['value'] = array(
+ $types['value'] = array(
'#input' => TRUE,
);
-
- $type['markup'] = array(
+ $types['markup'] = array(
'#markup' => '',
'#theme' => 'markup',
);
-
- $type['fieldset'] = array(
+ $types['fieldset'] = array(
'#collapsible' => FALSE,
'#collapsed' => FALSE,
'#value' => NULL,
@@ -474,19 +449,17 @@ function system_elements() {
'#pre_render' => array('form_pre_render_fieldset'),
'#theme_wrappers' => array('fieldset'),
);
-
- $type['vertical_tabs'] = array(
+ $types['vertical_tabs'] = array(
'#theme_wrappers' => array('vertical_tabs'),
'#default_tab' => '',
'#process' => array('form_process_vertical_tabs'),
);
-
- $type['token'] = array(
+ $types['token'] = array(
'#input' => TRUE,
'#theme' => array('hidden'),
);
- return $type;
+ return $types;
}
/**