You are here

function theme in Drupal 5

Same name and namespace in other branches
  1. 4 includes/theme.inc \theme()
  2. 6 includes/theme.inc \theme()
  3. 7 includes/theme.inc \theme()

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.

201 calls to theme()
aggregator_block in modules/aggregator/aggregator.module
Implementation of hook_block().
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.

... See full list

12 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.
drupal_get_css in includes/common.inc
Returns a themed representation of all stylesheets that should be attached to the page. It loads the CSS in order, with 'core' CSS first, then 'module' CSS, then 'theme' CSS files. This ensures proper cascading of styles…
init_theme in includes/theme.inc
Initialize the theme system by loading the theme.

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