Same name and namespace in other branches
  1. 5.x themes/engines/phptemplate/phptemplate.engine \_phptemplate_callback()

Execute a template engine call.

Each call to the template engine has two parts. Namely preparing the variables, and then doing something with them.

The first step is done by all template engines / themes, the second step is dependent on the engine used.

Parameters

$hook: The name of the theme function being executed.

$variables: A sequential array of variables passed to the theme function.

$file: A suggested template file to use. If the file is not found, the default $hook.tpl.php will be used.

Return value

The HTML generated by the template system.

5 calls to _phptemplate_callback()
phptemplate_block in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_block function to be passed into a pluggable template engine.
phptemplate_box in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_box function to be passed into a pluggable template engine.
phptemplate_comment in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_comment function to be passed into a pluggable template engine.
phptemplate_node in themes/engines/phptemplate/phptemplate.engine
phptemplate_page in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_page function to be passed into a pluggable template engine.

File

themes/engines/phptemplate/phptemplate.engine, line 54
Handles integration of templates written in pure php with the Drupal theme system.

Code

function _phptemplate_callback($hook, $variables = array(), $file = NULL) {
  $variables = array_merge($variables, _phptemplate_default_variables($hook, $variables));

  // Allow specified variables to be overridden
  if (function_exists('_phptemplate_variables')) {
    $variables = array_merge($variables, _phptemplate_variables($hook, $variables));
  }
  if (isset($variables['template_file'])) {
    $file = $variables['template_file'];
  }
  if (function_exists('_phptemplate_' . $hook)) {
    return call_user_func('_phptemplate_' . $hook, $variables, $file);
  }
  elseif (function_exists('_phptemplate_default')) {
    return call_user_func('_phptemplate_default', $hook, $variables, $file);
  }
}