Commit 523d64a4 authored by alexpott's avatar alexpott

Issue #1993312 by damiankloip, tim.plunkett: Change pre_render(),...

Issue #1993312 by damiankloip, tim.plunkett: Change pre_render(), post_render(), and after_build() callbacks to accept callables.
parent 530a6eda
......@@ -5214,8 +5214,8 @@ function drupal_render(&$elements) {
// that the $element or the children can be altered or corrected before the
// element is rendered into the final text.
if (isset($elements['#pre_render'])) {
foreach ($elements['#pre_render'] as $function) {
$elements = $function($elements);
foreach ($elements['#pre_render'] as $callable) {
$elements = call_user_func($callable, $elements);
}
}
......@@ -5286,8 +5286,8 @@ function drupal_render(&$elements) {
// content is sent to the browser. The changes are made on $content
// which allows the output'ed text to be filtered.
if (isset($elements['#post_render'])) {
foreach ($elements['#post_render'] as $function) {
$elements['#children'] = $function($elements['#children'], $elements);
foreach ($elements['#post_render'] as $callable) {
$elements['#children'] = call_user_func($callable, $elements['#children'], $elements);
}
}
......
......@@ -1750,7 +1750,7 @@ function form_error(&$element, $message = '') {
* adds the attributes and JavaScript needed to make the details work in older
* browsers. The #process functions are called in preorder traversal, meaning
* they are called for the parent element first, then for the child elements.
* - $element['#after_build']: An array of functions called after form_builder()
* - $element['#after_build']: An array of callables called after form_builder()
* is done with its processing of the element. These are called in postorder
* traversal, meaning they are called for the child elements first, then for
* the parent element.
......@@ -1939,8 +1939,8 @@ function form_builder($form_id, &$element, &$form_state) {
// The #after_build flag allows any piece of a form to be altered
// after normal input parsing has been completed.
if (isset($element['#after_build']) && !isset($element['#after_build_done'])) {
foreach ($element['#after_build'] as $function) {
$element = $function($element, $form_state);
foreach ($element['#after_build'] as $callable) {
$element = call_user_func_array($callable, array($element, &$form_state));
}
$element['#after_build_done'] = TRUE;
}
......
......@@ -278,12 +278,12 @@ function hook_queue_info_alter(&$queues) {
* (even if it's hidden).
* - "#process": array of callback functions taking $element, $form_state,
* and $complete_form.
* - "#after_build": array of callback functions taking $element and $form_state.
* - "#after_build": array of callables taking $element and $form_state.
* - "#validate": array of callback functions taking $form and $form_state.
* - "#element_validate": array of callback functions taking $element and
* $form_state.
* - "#pre_render": array of callback functions taking $element and $form_state.
* - "#post_render": array of callback functions taking $element and $form_state.
* - "#pre_render": array of callables taking $element.
* - "#post_render": array of callables taking $children and $element.
* - "#submit": array of callback functions taking $form and $form_state.
* - "#title_display": optional string indicating if and how #title should be
* displayed, see theme_form_element() and theme_form_element_label().
......
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