Process variables for page.tpl.php

Perform final addition of variables before passing them into the template. To customize these variables, simply set them in an earlier step.

See also

template_preprocess_page()

page.tpl.php

File

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

Code

function template_process_page(&$variables) {
  if (!isset($variables['breadcrumb'])) {

    // Build the breadcrumb last, so as to increase the chance of being able to
    // re-use the cache of an already rendered menu containing the active link
    // for the current page.
    // @see menu_tree_page_data()
    $variables['breadcrumb'] = theme('breadcrumb', array(
      'breadcrumb' => drupal_get_breadcrumb(),
    ));
  }
  if (!isset($variables['title'])) {
    $variables['title'] = drupal_get_title();
  }

  // Generate messages last in order to capture as many as possible for the
  // current page.
  if (!isset($variables['messages'])) {
    $variables['messages'] = $variables['show_messages'] ? theme('status_messages') : '';
  }
}