diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2008-01-30 21:42:17 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2008-01-30 21:42:17 +0000 |
commit | 9edadd40dcec14a14858d9eabde05d9acf256633 (patch) | |
tree | c2ec8144070d59c8bc081f5cae231ad243dc20df | |
parent | e85fa6970ffdb21d5b31a34f6da2b68e34d7059d (diff) | |
download | brdo-9edadd40dcec14a14858d9eabde05d9acf256633.tar.gz brdo-9edadd40dcec14a14858d9eabde05d9acf256633.tar.bz2 |
#216042 by Eaton: provide the complete form to element validators as well (critical regression for CCK)
-rw-r--r-- | includes/form.inc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/includes/form.inc b/includes/form.inc index f12585011..821101c0d 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -649,6 +649,8 @@ function drupal_redirect_form($form, $redirect = NULL) { * theming, and hook_form_alter functions. */ function _form_validate($elements, &$form_state, $form_id = NULL) { + static $complete_form; + // Also used in the installer, pre-database setup. $t = get_t(); @@ -696,16 +698,19 @@ function _form_validate($elements, &$form_state, $form_id = NULL) { } } - // Call user-defined form level validators. + // Call user-defined form level validators and store a copy of the full + // form so that element-specific validators can examine the entire structure + // if necessary. if (isset($form_id)) { form_execute_handlers('validate', $elements, $form_state); + $complete_form = $elements; } // Call any element-specific validators. These must act on the element // #value data. elseif (isset($elements['#element_validate'])) { foreach ($elements['#element_validate'] as $function) { if (function_exists($function)) { - $function($elements, $form_state); + $function($elements, $form_state, $complete_form); } } } |