diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-09-10 06:31:39 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-09-10 06:31:39 +0000 |
commit | d481f1cd364de615d274c2ccde68e37126f1959e (patch) | |
tree | bb4c488f30b310441fb81ef76f0edbad382cd3f0 /modules/field | |
parent | 46c4a33b21988a5420ffab0964c6a017abbb96b2 (diff) | |
download | brdo-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/field')
-rw-r--r-- | modules/field/field.api.php | 2 | ||||
-rw-r--r-- | modules/field/modules/number/number.module | 24 | ||||
-rw-r--r-- | modules/field/modules/options/options.module | 46 | ||||
-rw-r--r-- | modules/field/modules/text/text.module | 58 |
4 files changed, 58 insertions, 72 deletions
diff --git a/modules/field/field.api.php b/modules/field/field.api.php index 47c2da25c..5ed330f32 100644 --- a/modules/field/field.api.php +++ b/modules/field/field.api.php @@ -603,7 +603,7 @@ function hook_field_widget_info_alter(&$info) { * Return a single form element for a form. * * It will be built out and validated in the callback(s) listed in - * hook_elements. We build it out in the callbacks rather than in + * hook_element_info(). We build it out in the callbacks rather than in * hook_field_widget so it can be plugged into any module that can * provide it with valid $field information. * diff --git a/modules/field/modules/number/number.module b/modules/field/modules/number/number.module index dafe254cd..a95eace6b 100644 --- a/modules/field/modules/number/number.module +++ b/modules/field/modules/number/number.module @@ -292,32 +292,26 @@ function number_field_widget_info() { } /** - * Implement FAPI hook_elements(). - * - * Any FAPI callbacks needed for individual widgets can be declared here, - * and the element will be passed to those callbacks for processing. - * - * Drupal will automatically theme the element using a theme with - * the same name as the hook_elements key. + * Implement hook_element_info(). * * Includes a regex to check for valid values as an additional parameter * the validator can use. The regex can be overridden if necessary. */ -function number_elements() { - return array( - 'number' => array( - '#input' => TRUE, - '#columns' => array('value'), '#delta' => 0, - '#process' => array('number_elements_process'), - ), +function number_element_info() { + $types['number'] = array( + '#input' => TRUE, + '#columns' => array('value'), + '#delta' => 0, + '#process' => array('number_elements_process'), ); + return $types; } /** * Implement hook_field_widget(). * * Attach a single form element to the form. It will be built out and - * validated in the callback(s) listed in hook_elements. We build it + * validated in the callback(s) listed in hook_element_info(). We build it * out in the callbacks rather than here in hook_widget so it can be * plugged into any module that can provide it with valid * $field information. diff --git a/modules/field/modules/options/options.module b/modules/field/modules/options/options.module index 84e2e1615..b9ec74173 100644 --- a/modules/field/modules/options/options.module +++ b/modules/field/modules/options/options.module @@ -67,32 +67,28 @@ function options_field_widget_info() { } /** - * Implement FAPI hook_elements(). - * - * Any FAPI callbacks needed for individual widgets can be declared here, - * and the element will be passed to those callbacks for processing. - * - * Drupal will automatically theme the element using a theme with - * the same name as the hook_elements key. + * Implement hook_element_info(). */ -function options_elements() { - return array( - 'options_select' => array( - '#input' => TRUE, - '#columns' => array('value'), '#delta' => 0, - '#process' => array('options_select_elements_process'), - ), - 'options_buttons' => array( - '#input' => TRUE, - '#columns' => array('value'), '#delta' => 0, - '#process' => array('options_buttons_elements_process'), - ), - 'options_onoff' => array( - '#input' => TRUE, - '#columns' => array('value'), '#delta' => 0, - '#process' => array('options_onoff_elements_process'), - ), - ); +function options_element_info() { + $types['options_select'] = array( + '#input' => TRUE, + '#columns' => array('value'), + '#delta' => 0, + '#process' => array('options_select_elements_process'), + ); + $types['options_buttons'] = array( + '#input' => TRUE, + '#columns' => array('value'), + '#delta' => 0, + '#process' => array('options_buttons_elements_process'), + ); + $types['options_onoff'] = array( + '#input' => TRUE, + '#columns' => array('value'), + '#delta' => 0, + '#process' => array('options_onoff_elements_process'), + ); + return $types; } /** diff --git a/modules/field/modules/text/text.module b/modules/field/modules/text/text.module index d6653d873..db9ba24ed 100644 --- a/modules/field/modules/text/text.module +++ b/modules/field/modules/text/text.module @@ -521,48 +521,44 @@ function text_field_widget_settings_form($field, $instance) { } /** - * Implement FAPI hook_elements(). - * - * Any FAPI callbacks needed for individual widgets can be declared here, - * and the element will be passed to those callbacks for processing. - * - * Drupal will automatically theme the element using a theme with - * the same name as the hook_elements key. + * Implement hook_element_info(). * * Autocomplete_path is not used by text_field_widget but other * widgets can use it (see nodereference and userreference). */ -function text_elements() { - return array( - 'text_textfield' => array( - '#input' => TRUE, - '#columns' => array('value'), '#delta' => 0, - '#process' => array('text_textfield_elements_process'), - '#theme_wrappers' => array('text_textfield'), - '#autocomplete_path' => FALSE, - ), - 'text_textarea' => array( - '#input' => TRUE, - '#columns' => array('value', 'format'), '#delta' => 0, - '#process' => array('text_textarea_elements_process'), - '#theme_wrappers' => array('text_textarea'), - '#filter_value' => FILTER_FORMAT_DEFAULT, - ), - 'text_textarea_with_summary' => array( - '#input' => TRUE, - '#columns' => array('value', 'format', 'summary'), '#delta' => 0, - '#process' => array('text_textarea_with_summary_process'), - '#theme_wrappers' => array('text_textarea'), - '#filter_value' => FILTER_FORMAT_DEFAULT, - ), +function text_element_info() { + $types['text_textfield'] = array( + '#input' => TRUE, + '#columns' => array('value'), + '#delta' => 0, + '#process' => array('text_textfield_elements_process'), + '#theme_wrappers' => array('text_textfield'), + '#autocomplete_path' => FALSE, + ); + $types['text_textarea'] = array( + '#input' => TRUE, + '#columns' => array('value', 'format'), + '#delta' => 0, + '#process' => array('text_textarea_elements_process'), + '#theme_wrappers' => array('text_textarea'), + '#filter_value' => FILTER_FORMAT_DEFAULT, + ); + $types['text_textarea_with_summary'] = array( + '#input' => TRUE, + '#columns' => array('value', 'format', 'summary'), + '#delta' => 0, + '#process' => array('text_textarea_with_summary_process'), + '#theme_wrappers' => array('text_textarea'), + '#filter_value' => FILTER_FORMAT_DEFAULT, ); + return $types; } /** * Implement hook_field_widget(). * * Attach a single form element to the form. It will be built out and - * validated in the callback(s) listed in hook_elements. We build it + * validated in the callback(s) listed in hook_element_info(). We build it * out in the callbacks rather than here in hook_field_widget so it can be * plugged into any module that can provide it with valid * $field information. |