You are here

function theme_get_function in Drupal 4

Same name and namespace in other branches
  1. 5 includes/theme.inc \theme_get_function()

Determine if a theme function exists, and if so return which one was found.

Parameters

$function: The name of the theme function to test.

Return value

The name of the theme function that should be used, or false if no function exists.

2 calls to theme_get_function()
drupal_get_form in includes/form.inc
Processes a form array and produces the HTML output of a form. If there is input in the $_POST['edit'] variable, this function will attempt to validate it, using drupal_validate_form(), and then submit the form using drupal_submit_form().
theme in includes/theme.inc
Generate the themed representation of a Drupal object.

File

includes/theme.inc, line 177
The theme system, which controls the output of Drupal.

Code

function theme_get_function($function) {
  global $theme, $theme_engine;

  // Because theme() is called a lot, calling init_theme() only to have it
  // smartly return is a noticeable performance hit.   Don't do it.
  if (!isset($theme)) {
    init_theme();
  }
  if ($theme != '' && function_exists($theme . '_' . $function)) {

    // call theme function
    return $theme . '_' . $function;
  }
  elseif ($theme != '' && isset($theme_engine) && function_exists($theme_engine . '_' . $function)) {

    // call engine function
    return $theme_engine . '_' . $function;
  }
  elseif (function_exists('theme_' . $function)) {

    // call Drupal function
    return 'theme_' . $function;
  }
  return false;
}