Commit d73dc6b1 authored by Fabianx's avatar Fabianx

Issue #2652834 by david_garcia, Fabianx: Allow the use of callbacks instead of...

Issue #2652834 by david_garcia, Fabianx: Allow the use of callbacks instead of global functions in theme processor functions
parent f6ef7683
......@@ -61,6 +61,8 @@ Drupal 7.50, xxxx-xx-xx (development version)
- Made it possible to use any callable as an ajax form callback.
- Made it possible to use any callable as menu access, menu theme, menu title
and page delivery callback.
- Made it possible to use any callable as a theme processor or theme function
callback.
Drupal 7.44, 2016-06-15
-----------------------
......
......@@ -1119,7 +1119,7 @@ function theme($hook, $variables = array()) {
foreach (array('preprocess functions', 'process functions') as $phase) {
if (!empty($info[$phase])) {
foreach ($info[$phase] as $processor_function) {
if (function_exists($processor_function)) {
if (is_callable($processor_function)) {
// We don't want a poorly behaved process function changing $hook.
$hook_clone = $hook;
$processor_function($variables, $hook_clone);
......@@ -1157,7 +1157,7 @@ function theme($hook, $variables = array()) {
// Generate the output using either a function or a template.
$output = '';
if (isset($info['function'])) {
if (function_exists($info['function'])) {
if (is_callable($info['function'])) {
$output = $info['function']($variables);
}
}
......
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