_phptemplate_callback

themes/engines/phptemplate/phptemplate.engine, line 54

Versions
4.7
_phptemplate_callback($hook, $variables = array(), $file = NULL)
5
_phptemplate_callback($hook, $variables = array(), $suggestions = array())

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.

$suggestions An array of suggested template files to use. If none of the files are found, the default $hook.tpl.php will be used.

Return value

The HTML generated by the template system.

▾ 5 functions call _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. Uses block properties to generate a series of template file suggestions. If none are found, the default block.tpl.php is used.
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
Prepare the values passed to the theme_node function to be passed into a pluggable template 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. Uses the arg() function to generate a series of page template files suggestions based on the current path. If none are found, the default page.tpl.php...

Code

<?php
function _phptemplate_callback($hook, $variables = array(), $suggestions = array()) {
  global $theme_engine;

  $variables = array_merge($variables, _phptemplate_default_variables($hook, $variables));

  // Allow specified variables to be overridden
  $variables_function = '_'. $theme_engine .'_variables';
  if (function_exists($variables_function)) {
    $variables = array_merge($variables, call_user_func($variables_function, $hook, $variables));
  }

  if (isset($variables['template_files'])) {
    $suggestions = array_merge($suggestions, $variables['template_files']);
  }

  if (isset($variables['template_file'])) {
    $suggestions[] = $variables['template_file'];
  }

  $hook_function = '_'. $theme_engine .'_'. $hook;
  $default_function = '_'. $theme_engine .'_default';
  if (function_exists($hook_function)) {
    return call_user_func($hook_function, $variables, $suggestions);
  }
  elseif (function_exists($default_function)) {
    return call_user_func($default_function, $hook, $variables, $suggestions);
  }

}
?>
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.