Recent changes

2013-04-14 2013-04-02 2013-02-17 2013-01-29 2013-01-20 2013-01-18 2012-12-08 2012-11-06 2012-09-04 2012-08-02

drupal/functions/theme_get_function

theme_get_function

引数に指定された文字列にプレフィクスをつけた関数が存在するかどうかを調べ、存在する場合はプレフィクス付きの関数名を、そうでない場合はfalseを返す。

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

関連する変数や関数