Commit 9edadd40 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#216042 by Eaton: provide the complete form to element validators as well...

#216042 by Eaton: provide the complete form to element validators as well (critical regression for CCK)
parent e85fa697
......@@ -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);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment