|
1 <?php |
|
2 |
|
3 /** |
|
4 * Override of theme_breadcrumb(). |
|
5 */ |
|
6 function garland_breadcrumb($variables) { |
|
7 $breadcrumb = $variables['breadcrumb']; |
|
8 |
|
9 if (!empty($breadcrumb)) { |
|
10 // Provide a navigational heading to give context for breadcrumb links to |
|
11 // screen-reader users. Make the heading invisible with .element-invisible. |
|
12 $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>'; |
|
13 |
|
14 $output .= '<div class="breadcrumb">' . implode(' › ', $breadcrumb) . '</div>'; |
|
15 return $output; |
|
16 } |
|
17 } |
|
18 |
|
19 /** |
|
20 * Override or insert variables into the maintenance page template. |
|
21 */ |
|
22 function garland_preprocess_maintenance_page(&$variables) { |
|
23 // While markup for normal pages is split into page.tpl.php and html.tpl.php, |
|
24 // the markup for the maintenance page is all in the single |
|
25 // maintenance-page.tpl.php template. So, to have what's done in |
|
26 // garland_preprocess_html() also happen on the maintenance page, it has to be |
|
27 // called here. |
|
28 garland_preprocess_html($variables); |
|
29 } |
|
30 |
|
31 /** |
|
32 * Override or insert variables into the html template. |
|
33 */ |
|
34 function garland_preprocess_html(&$variables) { |
|
35 // Toggle fixed or fluid width. |
|
36 if (theme_get_setting('garland_width') == 'fluid') { |
|
37 $variables['classes_array'][] = 'fluid-width'; |
|
38 } |
|
39 // Add conditional CSS for IE6. |
|
40 drupal_add_css(path_to_theme() . '/fix-ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lt IE 7', '!IE' => FALSE), 'preprocess' => FALSE)); |
|
41 } |
|
42 |
|
43 /** |
|
44 * Override or insert variables into the html template. |
|
45 */ |
|
46 function garland_process_html(&$variables) { |
|
47 // Hook into color.module |
|
48 if (module_exists('color')) { |
|
49 _color_html_alter($variables); |
|
50 } |
|
51 } |
|
52 |
|
53 /** |
|
54 * Override or insert variables into the page template. |
|
55 */ |
|
56 function garland_preprocess_page(&$variables) { |
|
57 // Move secondary tabs into a separate variable. |
|
58 $variables['tabs2'] = array( |
|
59 '#theme' => 'menu_local_tasks', |
|
60 '#secondary' => $variables['tabs']['#secondary'], |
|
61 ); |
|
62 unset($variables['tabs']['#secondary']); |
|
63 |
|
64 if (isset($variables['main_menu'])) { |
|
65 $variables['primary_nav'] = theme('links__system_main_menu', array( |
|
66 'links' => $variables['main_menu'], |
|
67 'attributes' => array( |
|
68 'class' => array('links', 'inline', 'main-menu'), |
|
69 ), |
|
70 'heading' => array( |
|
71 'text' => t('Main menu'), |
|
72 'level' => 'h2', |
|
73 'class' => array('element-invisible'), |
|
74 ) |
|
75 )); |
|
76 } |
|
77 else { |
|
78 $variables['primary_nav'] = FALSE; |
|
79 } |
|
80 if (isset($variables['secondary_menu'])) { |
|
81 $variables['secondary_nav'] = theme('links__system_secondary_menu', array( |
|
82 'links' => $variables['secondary_menu'], |
|
83 'attributes' => array( |
|
84 'class' => array('links', 'inline', 'secondary-menu'), |
|
85 ), |
|
86 'heading' => array( |
|
87 'text' => t('Secondary menu'), |
|
88 'level' => 'h2', |
|
89 'class' => array('element-invisible'), |
|
90 ) |
|
91 )); |
|
92 } |
|
93 else { |
|
94 $variables['secondary_nav'] = FALSE; |
|
95 } |
|
96 |
|
97 // Prepare header. |
|
98 $site_fields = array(); |
|
99 if (!empty($variables['site_name'])) { |
|
100 $site_fields[] = $variables['site_name']; |
|
101 } |
|
102 if (!empty($variables['site_slogan'])) { |
|
103 $site_fields[] = $variables['site_slogan']; |
|
104 } |
|
105 $variables['site_title'] = implode(' ', $site_fields); |
|
106 if (!empty($site_fields)) { |
|
107 $site_fields[0] = '<span>' . $site_fields[0] . '</span>'; |
|
108 } |
|
109 $variables['site_html'] = implode(' ', $site_fields); |
|
110 |
|
111 // Set a variable for the site name title and logo alt attributes text. |
|
112 $slogan_text = $variables['site_slogan']; |
|
113 $site_name_text = $variables['site_name']; |
|
114 $variables['site_name_and_slogan'] = $site_name_text . ' ' . $slogan_text; |
|
115 } |
|
116 |
|
117 /** |
|
118 * Override or insert variables into the node template. |
|
119 */ |
|
120 function garland_preprocess_node(&$variables) { |
|
121 $variables['submitted'] = $variables['date'] . ' — ' . $variables['name']; |
|
122 } |
|
123 |
|
124 /** |
|
125 * Override or insert variables into the comment template. |
|
126 */ |
|
127 function garland_preprocess_comment(&$variables) { |
|
128 $variables['submitted'] = $variables['created'] . ' — ' . $variables['author']; |
|
129 } |
|
130 |
|
131 /** |
|
132 * Override or insert variables into the block template. |
|
133 */ |
|
134 function garland_preprocess_block(&$variables) { |
|
135 $variables['title_attributes_array']['class'][] = 'title'; |
|
136 $variables['classes_array'][] = 'clearfix'; |
|
137 } |
|
138 |
|
139 /** |
|
140 * Override or insert variables into the page template. |
|
141 */ |
|
142 function garland_process_page(&$variables) { |
|
143 // Hook into color.module |
|
144 if (module_exists('color')) { |
|
145 _color_page_alter($variables); |
|
146 } |
|
147 } |
|
148 |
|
149 /** |
|
150 * Override or insert variables into the region template. |
|
151 */ |
|
152 function garland_preprocess_region(&$variables) { |
|
153 if ($variables['region'] == 'header') { |
|
154 $variables['classes_array'][] = 'clearfix'; |
|
155 } |
|
156 } |