From fe8e4c4cd37efee49cf1856be9c1be1ef030e0bd Mon Sep 17 00:00:00 2001
From: David Rothstein <drothstein@gmail.com>
Date: Tue, 5 Jul 2016 22:47:05 -0400
Subject: [PATCH] Revert "Issue #2652814 by Fabianx, stefan.r, david_garcia,
 Ayesh, David_Rothstein: Allow the use of callbacks for element value
 callbacks and batch API redirect callbacks"

This reverts commit ee2f0346e245818283cd279a9750d113bd6ef293.
---
 CHANGELOG.txt     |  2 --
 includes/form.inc | 13 ++++++-------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index b70ceecee4d5..531357609c30 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -161,8 +161,6 @@ Drupal 7.40, 2015-10-14
   to fail when there were multiple file records pointing to the same file.
 - Added a new option to format_xml_elements() to allow for already encoded
   values.
-- Added support for the use of callbacks instead of functions in
-  #value_callback.
 - Numerous small bug fixes.
 - Numerous API documentation improvements.
 - Additional automated test coverage.
diff --git a/includes/form.inc b/includes/form.inc
index 2b40ad7ca4bd..130775f4d1da 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -1719,10 +1719,9 @@ function form_error(&$element, $message = '') {
  * each element). Each of these three pipelines provides ample opportunity for
  * modules to customize what happens. For example, during this function's life
  * cycle, the following functions get called for each element:
- * - $element['#value_callback']: A function (or as of Drupal 7.50, any kind of
- *   callback) that implements how user input is mapped to an element's #value
- *    property. This defaults to a function named 'form_type_TYPE_value' where
- *    TYPE is $element['#type'].
+ * - $element['#value_callback']: A function that implements how user input is
+ *   mapped to an element's #value property. This defaults to a function named
+ *   'form_type_TYPE_value' where TYPE is $element['#type'].
  * - $element['#process']: An array of functions called after user input has
  *   been mapped to the element's #value property. These functions can be used
  *   to dynamically add child elements: for example, for the 'date' element
@@ -2102,7 +2101,7 @@ function _form_builder_handle_input_element($form_id, &$element, &$form_state) {
       // If we have input for the current element, assign it to the #value
       // property, optionally filtered through $value_callback.
       if ($input_exists) {
-        if (is_callable($value_callback)) {
+        if (function_exists($value_callback)) {
           // Skip all value callbacks except safe ones like text if the CSRF
           // token was invalid.
           if (empty($form_state['invalid_token']) || in_array($value_callback, $safe_core_value_callbacks)) {
@@ -2124,7 +2123,7 @@ function _form_builder_handle_input_element($form_id, &$element, &$form_state) {
     // Load defaults.
     if (!isset($element['#value'])) {
       // Call #type_value without a second argument to request default_value handling.
-      if (is_callable($value_callback)) {
+      if (function_exists($value_callback)) {
         $element['#value'] = $value_callback($element, FALSE, $form_state);
       }
       // Final catch. If we haven't set a value yet, use the explicit default value.
@@ -4704,7 +4703,7 @@ function batch_process($redirect = NULL, $url = 'batch', $redirect_callback = 'd
 
       // Redirect for processing.
       $function = $batch['redirect_callback'];
-      if (is_callable($function)) {
+      if (function_exists($function)) {
         $function($batch['url'], array('query' => array('op' => 'start', 'id' => $batch['id'])));
       }
     }
-- 
GitLab