/[drupal]/drupal/themes/garland/template.php
ViewVC logotype

Contents of /drupal/themes/garland/template.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.37 - (show annotations) (download) (as text)
Sat Jan 30 07:59:26 2010 UTC (10 days, 12 hours ago) by dries
Branch: MAIN
CVS Tags: HEAD
Changes since 1.36: +2 -2 lines
File MIME type: text/x-php
- Patch #606526 by axyjo, scor: remove trailing whitespaces and add newlines at end of files.
1 <?php
2 // $Id: template.php,v 1.36 2010/01/08 07:36:53 webchick 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 maintenance page template.
26 */
27 function garland_preprocess_maintenance_page(&$vars) {
28 // Toggle fixed or fluid width.
29 if (theme_get_setting('garland_width') == 'fluid') {
30 $vars['classes_array'][] = 'fluid-width';
31 }
32 }
33
34 /**
35 * Override or insert variables into the html template.
36 */
37 function garland_preprocess_html(&$vars) {
38 // Toggle fixed or fluid width.
39 if (theme_get_setting('garland_width') == 'fluid') {
40 $vars['classes_array'][] = 'fluid-width';
41 }
42 }
43
44 /**
45 * Override or insert variables into the html template.
46 */
47 function garland_process_html(&$vars) {
48 // Hook into color.module
49 if (module_exists('color')) {
50 _color_html_alter($vars);
51 }
52 $vars['styles'] .= "\n<!--[if lt IE 7]>\n" . garland_get_ie_styles() . "<![endif]-->\n";
53 }
54
55 /**
56 * Override or insert variables into the page template.
57 */
58 function garland_preprocess_page(&$vars) {
59 $vars['tabs2'] = menu_secondary_local_tasks();
60 if (isset($vars['main_menu'])) {
61 $vars['primary_nav'] = theme('links__system_main_menu', array(
62 'links' => $vars['main_menu'],
63 'attributes' => array(
64 'class' => array('links', 'main-menu'),
65 ),
66 'heading' => array(
67 'text' => t('Main menu'),
68 'level' => 'h2',
69 'class' => array('element-invisible'),
70 )
71 ));
72 }
73 else {
74 $vars['primary_nav'] = FALSE;
75 }
76 if (isset($vars['secondary_menu'])) {
77 $vars['secondary_nav'] = theme('links__system_secondary_menu', array(
78 'links' => $vars['secondary_menu'],
79 'attributes' => array(
80 'class' => array('links', 'secondary-menu'),
81 ),
82 'heading' => array(
83 'text' => t('Secondary menu'),
84 'level' => 'h2',
85 'class' => array('element-invisible'),
86 )
87 ));
88 }
89 else {
90 $vars['secondary_nav'] = FALSE;
91 }
92
93 // Prepare header.
94 $site_fields = array();
95 if (!empty($vars['site_name'])) {
96 $site_fields[] = check_plain($vars['site_name']);
97 }
98 if (!empty($vars['site_slogan'])) {
99 $site_fields[] = check_plain($vars['site_slogan']);
100 }
101 $vars['site_title'] = implode(' ', $site_fields);
102 if (!empty($site_fields)) {
103 $site_fields[0] = '<span>' . $site_fields[0] . '</span>';
104 }
105 $vars['site_html'] = implode(' ', $site_fields);
106
107 // Set a variable for the site name title and logo alt attributes text.
108 $slogan_text = filter_xss_admin(variable_get('site_slogan', ''));
109 $site_name_text = filter_xss_admin(variable_get('site_name', 'Drupal'));
110 $vars['site_name_and_slogan'] = $site_name_text . ' ' . $slogan_text;
111 }
112
113 /**
114 * Override or insert variables into the page template.
115 */
116 function garland_process_page(&$vars) {
117 // Hook into color.module
118 if (module_exists('color')) {
119 _color_page_alter($vars);
120 }
121 }
122
123 /**
124 * Override or insert variables into the region template.
125 */
126 function garland_preprocess_region(&$vars) {
127 if ($vars['region'] == 'header') {
128 $vars['classes_array'][] = 'clearfix';
129 }
130 }
131
132 /**
133 * Returns the rendered local tasks. The default implementation renders
134 * them as tabs. Overridden to split the secondary tasks.
135 */
136 function garland_menu_local_tasks() {
137 return menu_primary_local_tasks();
138 }
139
140 /**
141 * Generates IE CSS links for LTR and RTL languages.
142 */
143 function garland_get_ie_styles() {
144 global $language;
145
146 $ie_styles = '<link type="text/css" rel="stylesheet" media="all" href="' . file_create_url(path_to_theme() . '/fix-ie.css') . '" />' . "\n";
147 if ($language->direction == LANGUAGE_RTL) {
148 $ie_styles .= ' <style type="text/css" media="all">@import "' . file_create_url(path_to_theme() . '/fix-ie-rtl.css') . '";</style>' . "\n";
149 }
150
151 return $ie_styles;
152 }

  ViewVC Help
Powered by ViewVC 1.1.3