Skip to content
Snippets Groups Projects
Commit 701faf84 authored by Nate Lampton's avatar Nate Lampton
Browse files

#328383. Provide hook_preprocess_link() to Drupal 5.

parent 9a09ac81
No related branches found
Tags 5.x-1.0-beta6
No related merge requests found
......@@ -810,7 +810,8 @@ function theme_flag($flag, $action, $content_id, $after_flagging = FALSE) {
'content_id' => $content_id,
'after_flagging' => $after_flagging,
);
template_preprocess_flag($variables);
flag_template_preprocess('flag', $variables);
extract($variables);
ob_start();
include $template;
......@@ -887,7 +888,7 @@ function flag_phptemplate_adapter($flag, $action, $content_id, $after_flagging =
'content_id' => $content_id,
'after_flagging' => $after_flagging,
);
template_preprocess_flag($variables);
flag_template_preprocess('flag', $variables);
// Prepare an array of suggested templates to try.
$suggestions = array();
......@@ -904,6 +905,29 @@ function flag_phptemplate_adapter($flag, $action, $content_id, $after_flagging =
return $output;
}
/**
* Call module flag preprocess functions for Drupal 5.
*
* The preprocess functions for themes and phptemplate can be done in
* _phptemplate_variables(), but this adds preprocessing to modules that don't
* have this access in Drupal 5.
*
* @param $hook
* The name of the template file hook whose variables are being preprocessed.
* @param $variables
* The existing variables that will be passed to the template file.
*/
function flag_template_preprocess($hook, &$variables) {
if (function_exists('template_preprocess_'. $hook)) {
$function = 'template_preprocess_'. $hook;
$function($variables);
}
foreach (module_implements('preprocess_'. $hook) as $module) {
$function = $module .'_preprocess_'. $hook;
$function($variables);
}
}
/**
* Format a string containing a count of items.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment