From 8417887353eed6e056294f55e4af7eb27d6abb9e Mon Sep 17 00:00:00 2001 From: Daniel Wehner Date: Thu, 20 Nov 2014 16:48:37 +0100 Subject: [PATCH] Make it possible to use any kind of callable as submit handlers --- includes/form.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/form.inc b/includes/form.inc index e5bae605bea..c950938d079 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -817,7 +817,7 @@ function form_execute_handlers($type, &$form, &$form_state) { } foreach ($handlers as $function) { - if (function_exists($function)) { + if (is_callable($function)) { // Check to see if a previous _submit handler has set a batch, but // make sure we do not react to a batch that is already being processed // (for instance if a batch operation performs a drupal_execute()). @@ -828,7 +828,7 @@ function form_execute_handlers($type, &$form, &$form_state) { $batch['sets'][] = array('form_submit' => $function); } else { - $function($form, $form_state); + call_user_func_array($function, array($form, &$form_state)); } $return = TRUE; }