diff options
author | Dries Buytaert <dries@buytaert.net> | 2007-03-17 18:30:14 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2007-03-17 18:30:14 +0000 |
commit | 4b635f6d0a21e9a1358a6f9540ef72a55682738b (patch) | |
tree | 2b789c7c25f3670f676c8e029249582497e3c060 /includes | |
parent | f6929dcca0870e6d38654a126fe4f6c422cd9936 (diff) | |
download | brdo-4b635f6d0a21e9a1358a6f9540ef72a55682738b.tar.gz brdo-4b635f6d0a21e9a1358a6f9540ef72a55682738b.tar.bz2 |
- Patch #128081 by Eaton: remove #base, paving the path for a simpler form API.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/form.inc | 17 | ||||
-rw-r--r-- | includes/locale.inc | 12 |
2 files changed, 10 insertions, 19 deletions
diff --git a/includes/form.inc b/includes/form.inc index b2ad0e491..545ad33ef 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -248,7 +248,7 @@ function drupal_process_form($form_id, &$form) { $form_button_counter = array(0, 0); drupal_prepare_form($form_id, $form); - if (($form['#programmed']) || (!empty($_POST) && (($_POST['form_id'] == $form_id) || ($_POST['form_id'] == $form['#base'])))) { + if (($form['#programmed']) || (!empty($_POST) && (($_POST['form_id'] == $form_id)))) { drupal_validate_form($form_id, $form); // IE does not send a button value when there is only one submit button (and no non-submit buttons) // and you submit by pressing enter. @@ -307,11 +307,6 @@ function drupal_prepare_form($form_id, &$form) { ); } - // If $base is set, it is used in place of $form_id when constructing validation, - // submission, and theming functions. Useful for mapping many similar or duplicate - // forms with different $form_ids to the same processing functions. - $base = isset($form['#base']) ? $form['#base'] : ''; - // Add a token, based on either #token or form_id, to any form displayed to // authenticated users. This ensures that any submitted form was actually // requested previously by the user and protects against cross site request @@ -347,9 +342,6 @@ function drupal_prepare_form($form_id, &$form) { if (function_exists($form_id .'_validate')) { $form['#validate'] = array($form_id .'_validate' => array()); } - elseif (function_exists($base .'_validate')) { - $form['#validate'] = array($base .'_validate' => array()); - } } if (!isset($form['#submit'])) { @@ -357,9 +349,6 @@ function drupal_prepare_form($form_id, &$form) { // We set submit here so that it can be altered. $form['#submit'] = array($form_id .'_submit' => array()); } - elseif (function_exists($base .'_submit')) { - $form['#submit'] = array($base .'_submit' => array()); - } } foreach (module_implements('form_alter') as $module) { @@ -469,15 +458,11 @@ function drupal_submit_form($form_id, $form) { */ function drupal_render_form($form_id, &$form) { // Don't override #theme if someone already set it. - $base = isset($form['#base']) ? $form['#base'] : ''; if (!isset($form['#theme'])) { if (theme_get_function($form_id)) { $form['#theme'] = $form_id; } - elseif (theme_get_function($base)) { - $form['#theme'] = $base; - } } if (isset($form['#pre_render'])) { diff --git a/includes/locale.inc b/includes/locale.inc index f6b7d948a..9362295b0 100644 --- a/includes/locale.inc +++ b/includes/locale.inc @@ -75,7 +75,9 @@ function _locale_admin_manage_screen() { '#default_value' => $isdefault, ); $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration')); - $form['#base'] = 'locale_admin_manage_screen'; + $form['#submit']['locale_admin_manage_screen_submit'] = array(); + $form['#validate']['locale_admin_manage_screen_validate'] = array(); + $form['#theme'] = 'locale_admin_manage_screen'; return $form; } @@ -162,7 +164,9 @@ function locale_custom_language_form() { ); $form['custom language']['submit'] = array('#type' => 'submit', '#value' => t('Add custom language')); // Use the validation and submit functions of the add language form. - $form['#base'] = 'locale_add_language_form'; + $form['#submit']['locale_add_language_form_submit'] = array(); + $form['#validate']['locale_add_language_form_validate'] = array(); + $form['#theme'] = 'locale_add_language_form'; return $form; } @@ -294,7 +298,9 @@ function _locale_export_pot_form() { '#description' => t('Generate a gettext Portable Object Template (.pot) file with all the interface strings from the Drupal locale database.'), ); $form['export']['submit'] = array('#type' => 'submit', '#value' => t('Export')); - $form['#base'] = '_locale_export_po_form'; + $form['#submit']['_locale_export_po_form_submit'] = array(); + $form['#validate']['_locale_export_po_form_validate'] = array(); + $form['#theme'] = '_locale_export_po_form'; return $form; } |