| 1 |
<?php
|
| 2 |
// $Id: template.php,v 1.33 2009/10/09 01:00:08 dries Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Return a themed breadcrumb trail.
|
| 6 |
*
|
| 7 |
* @param $breadcrumb
|
| 8 |
* An array containing the breadcrumb links.
|
| 9 |
* @return a string containing the breadcrumb output.
|
| 10 |
*/
|
| 11 |
function garland_breadcrumb($variables) {
|
| 12 |
$breadcrumb = $variables['breadcrumb'];
|
| 13 |
|
| 14 |
if (!empty($breadcrumb)) {
|
| 15 |
// Provide a navigational heading to give context for breadcrumb links to
|
| 16 |
// screen-reader users. Make the heading invisible with .element-invisible.
|
| 17 |
$output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
|
| 18 |
|
| 19 |
$output .= '<div class="breadcrumb">' . implode(' › ', $breadcrumb) . '</div>';
|
| 20 |
return $output;
|
| 21 |
}
|
| 22 |
}
|
| 23 |
|
| 24 |
/**
|
| 25 |
* Override or insert variables into the html template.
|
| 26 |
*/
|
| 27 |
function garland_process_html(&$vars) {
|
| 28 |
// Hook into color.module
|
| 29 |
if (module_exists('color')) {
|
| 30 |
_color_html_alter($vars);
|
| 31 |
}
|
| 32 |
$vars['styles'] .= "\n<!--[if lt IE 7]>\n" . garland_get_ie_styles() . "<![endif]-->\n";
|
| 33 |
}
|
| 34 |
|
| 35 |
/**
|
| 36 |
* Override or insert variables into the page template.
|
| 37 |
*/
|
| 38 |
function garland_preprocess_page(&$vars) {
|
| 39 |
$vars['tabs2'] = menu_secondary_local_tasks();
|
| 40 |
if (isset($vars['main_menu'])) {
|
| 41 |
$vars['primary_nav'] = theme('links', array(
|
| 42 |
'links' => $vars['main_menu'],
|
| 43 |
'attributes' => array(
|
| 44 |
'class' => array('links', 'main-menu'),
|
| 45 |
),
|
| 46 |
'heading' => array(
|
| 47 |
'text' => t('Main menu'),
|
| 48 |
'level' => 'h2',
|
| 49 |
'class' => array('element-invisible'),
|
| 50 |
)
|
| 51 |
));
|
| 52 |
}
|
| 53 |
else {
|
| 54 |
$vars['primary_nav'] = FALSE;
|
| 55 |
}
|
| 56 |
if (isset($vars['secondary_menu'])) {
|
| 57 |
$vars['secondary_nav'] = theme('links', array(
|
| 58 |
'links' => $vars['secondary_menu'],
|
| 59 |
'attributes' => array(
|
| 60 |
'class' => array('links', 'secondary-menu'),
|
| 61 |
),
|
| 62 |
'heading' => array(
|
| 63 |
'text' => t('Secondary menu'),
|
| 64 |
'level' => 'h2',
|
| 65 |
'class' => array('element-invisible'),
|
| 66 |
)
|
| 67 |
));
|
| 68 |
}
|
| 69 |
else {
|
| 70 |
$vars['secondary_nav'] = FALSE;
|
| 71 |
}
|
| 72 |
|
| 73 |
// Prepare header.
|
| 74 |
$site_fields = array();
|
| 75 |
if (!empty($vars['site_name'])) {
|
| 76 |
$site_fields[] = check_plain($vars['site_name']);
|
| 77 |
}
|
| 78 |
if (!empty($vars['site_slogan'])) {
|
| 79 |
$site_fields[] = check_plain($vars['site_slogan']);
|
| 80 |
}
|
| 81 |
$vars['site_title'] = implode(' ', $site_fields);
|
| 82 |
if (!empty($site_fields)) {
|
| 83 |
$site_fields[0] = '<span>' . $site_fields[0] . '</span>';
|
| 84 |
}
|
| 85 |
$vars['site_html'] = implode(' ', $site_fields);
|
| 86 |
|
| 87 |
// Set a variable for the site name title and logo alt attributes text.
|
| 88 |
$slogan_text = filter_xss_admin(variable_get('site_slogan', ''));
|
| 89 |
$site_name_text = filter_xss_admin(variable_get('site_name', 'Drupal'));
|
| 90 |
$vars['site_name_and_slogan'] = $site_name_text . ' ' . $slogan_text;
|
| 91 |
}
|
| 92 |
|
| 93 |
/**
|
| 94 |
* Override or insert variables into the page template.
|
| 95 |
*/
|
| 96 |
function garland_process_page(&$vars) {
|
| 97 |
// Hook into color.module
|
| 98 |
if (module_exists('color')) {
|
| 99 |
_color_page_alter($vars);
|
| 100 |
}
|
| 101 |
}
|
| 102 |
|
| 103 |
/**
|
| 104 |
* Override or insert variables into the region template.
|
| 105 |
*/
|
| 106 |
function garland_preprocess_region(&$vars) {
|
| 107 |
if ($vars['region'] == 'header') {
|
| 108 |
$vars['classes_array'][] = 'clearfix';
|
| 109 |
}
|
| 110 |
}
|
| 111 |
|
| 112 |
/**
|
| 113 |
* Returns the rendered local tasks. The default implementation renders
|
| 114 |
* them as tabs. Overridden to split the secondary tasks.
|
| 115 |
*/
|
| 116 |
function garland_menu_local_tasks() {
|
| 117 |
return menu_primary_local_tasks();
|
| 118 |
}
|
| 119 |
|
| 120 |
/**
|
| 121 |
* Generates IE CSS links for LTR and RTL languages.
|
| 122 |
*/
|
| 123 |
function garland_get_ie_styles() {
|
| 124 |
global $language;
|
| 125 |
|
| 126 |
$ie_styles = '<link type="text/css" rel="stylesheet" media="all" href="' . file_create_url(path_to_theme() . '/fix-ie.css') . '" />' . "\n";
|
| 127 |
if ($language->direction == LANGUAGE_RTL) {
|
| 128 |
$ie_styles .= ' <style type="text/css" media="all">@import "' . file_create_url(path_to_theme() . '/fix-ie-rtl.css') . '";</style>' . "\n";
|
| 129 |
}
|
| 130 |
|
| 131 |
return $ie_styles;
|
| 132 |
}
|