summaryrefslogtreecommitdiff
path: root/includes/form.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/form.inc')
-rw-r--r--includes/form.inc9
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);
}
}
}