Full ELMS Learning Network documentation
function template_preprocess_page
cis7 theme.inc | template_preprocess_page(&$variables) |
cle7 theme.inc | template_preprocess_page(&$variables) |
elmsmedia7 theme.inc | template_preprocess_page(&$variables) |
icor7 theme.inc | template_preprocess_page(&$variables) |
meedjum_blog7 theme.inc | template_preprocess_page(&$variables) |
mooc7 theme.inc | template_preprocess_page(&$variables) |
Preprocess variables for page.tpl.php
Most themes utilize their own copy of page.tpl.php. The default is located inside "modules/system/page.tpl.php". Look in there for the full list of variables.
Uses the arg() function to generate a series of page template suggestions based on the current path.
Any changes to variables in this preprocessor should also be changed inside template_preprocess_maintenance_page() to keep all of them consistent.
See also
1 call to template_preprocess_page()
- template_preprocess_wysiwyg_dialog_page in sites/
all/ modules/ ulmus/ wysiwyg/ wysiwyg.dialog.inc - Template preprocess function for theme_wysiwyg_dialog_page().
1 string reference to 'template_preprocess_page'
- context_theme_registry_alter in sites/
all/ modules/ ulmus/ context/ context.core.inc - Implementation of hook_theme_registry_alter().
File
- includes/
theme.inc, line 2545 - The theme system, which controls the output of Drupal.
Code
function template_preprocess_page(&$variables) {
// Move some variables to the top level for themer convenience and template cleanliness.
$variables['show_messages'] = $variables['page']['#show_messages'];
foreach (system_region_list($GLOBALS['theme']) as $region_key => $region_name) {
if (!isset($variables['page'][$region_key])) {
$variables['page'][$region_key] = array();
}
}
// Set up layout variable.
$variables['layout'] = 'none';
if (!empty($variables['page']['sidebar_first'])) {
$variables['layout'] = 'first';
}
if (!empty($variables['page']['sidebar_second'])) {
$variables['layout'] = ($variables['layout'] == 'first') ? 'both' : 'second';
}
$variables['base_path'] = base_path();
$variables['front_page'] = url();
$variables['feed_icons'] = drupal_get_feeds();
$variables['language'] = $GLOBALS['language'];
$variables['language']->dir = $GLOBALS['language']->direction ? 'rtl' : 'ltr';
$variables['logo'] = theme_get_setting('logo');
$variables['main_menu'] = theme_get_setting('toggle_main_menu') ? menu_main_menu() : array();
$variables['secondary_menu'] = theme_get_setting('toggle_secondary_menu') ? menu_secondary_menu() : array();
$variables['action_links'] = menu_local_actions();
$variables['site_name'] = (theme_get_setting('toggle_name') ? filter_xss_admin(variable_get('site_name', 'Drupal')) : '');
$variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? filter_xss_admin(variable_get('site_slogan', '')) : '');
$variables['tabs'] = menu_local_tabs();
if ($node = menu_get_object()) {
$variables['node'] = $node;
}
// Populate the page template suggestions.
if ($suggestions = theme_get_suggestions(arg(), 'page')) {
$variables['theme_hook_suggestions'] = $suggestions;
}
}