theme_get_function

Versions
5
theme_get_function($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.

▾ 5 functions call theme_get_function()

drupal_render_form in 5/includes/form.inc
Renders a structured form array into themed HTML.
theme in 5/includes/theme.inc
Generate the themed representation of a Drupal object.
uc_product_views_handler_add_to_cart_link in contributions/ubercart/uc_product/uc_product.module
Return a formatted add to cart form to display in the View.
views_theme in contributions/views/views.module
Easily theme any item to a view.
views_theme_field in contributions/views/views.module
Easily theme any item to a field name. field name will be in the format of TABLENAME_FIELDNAME You have to understand a bit about the views data to utilize this.

Code

5/includes/theme.inc, line 182

<?php
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;
}
?>