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 ee2f0346e2.
merge-requests/26/head
David Rothstein 2016-07-05 22:47:05 -04:00
parent 6303a15671
commit fe8e4c4cd3
2 changed files with 6 additions and 9 deletions

View File

@ -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.

View File

@ -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'])));
}
}