4.6.x theme.inc theme()
4.7.x theme.inc theme()
5.x theme.inc theme()
6.x theme.inc theme()
7.x theme.inc theme($hook, $variables = array())

Generate the themed representation of a Drupal object.

All requests for themed functions must go through this function. It examines the request and routes it to the appropriate theme function. If the current theme does not implement the requested function, then the current theme engine is checked. If neither the engine nor theme implement the requested function, then the base theme function is called.

For example, to retrieve the HTML that is output by theme_page($output), a module should call theme('page', $output).

Parameters

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

...: Additional arguments to pass along to the theme function.

Return value

An HTML string that generates the themed output.

180 calls to theme()
aggregator_page_categories in modules/aggregator/aggregator.module
Menu callback; displays all the categories used by the aggregator.
aggregator_page_list in modules/aggregator/aggregator.module
aggregator_page_source in modules/aggregator/aggregator.module
Menu callback; displays all the items captured from a particular feed.
aggregator_page_sources in modules/aggregator/aggregator.module
Menu callback; displays all the feeds used by the aggregator.
aggregator_view in modules/aggregator/aggregator.module

... See full list

8 string references to 'theme'
chameleon_page in themes/chameleon/chameleon.theme
color_get_info in modules/color/color.module
Retrieve the color.module info for a particular theme.
color_scheme_form_submit in modules/color/color.module
Submit handler for color change form.
init_theme in includes/theme.inc
Initialize the theme system by loading the theme.
st in includes/install.inc
Hardcoded function for doing the equivalent of theme('placeholder') when the theme system is not available.

... See full list

File

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

Code

function theme() {
  static $functions;
  $args = func_get_args();
  $function = array_shift($args);
  if (!isset($functions[$function])) {
    $functions[$function] = theme_get_function($function);
  }
  if ($functions[$function]) {
    $output = call_user_func_array($functions[$function], $args);

    // Add final markup to the full page.
    if ($function == 'page' || $function == 'book_export_html') {
      $output = drupal_final_markup($output);
    }
    return $output;
  }
}