1 |
87dbc3bf
|
Benjamin Luce
|
<?php
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
if (theme_get_setting('zen_rebuild_registry') && !defined('MAINTENANCE_MODE')) {
|
16 |
|
|
|
17 |
|
|
system_rebuild_theme_data();
|
18 |
|
|
|
19 |
|
|
drupal_theme_rebuild();
|
20 |
|
|
}
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
function zen_theme(&$existing, $type, $theme, $path) {
|
27 |
|
|
include_once './' . drupal_get_path('theme', 'zen') . '/zen-internals/template.theme-registry.inc';
|
28 |
|
|
return _zen_theme($existing, $type, $theme, $path);
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
function zen_breadcrumb($variables) {
|
44 |
|
|
$breadcrumb = $variables['breadcrumb'];
|
45 |
|
|
$output = '';
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
$show_breadcrumb = theme_get_setting('zen_breadcrumb');
|
49 |
|
|
if ($show_breadcrumb == 'yes' || $show_breadcrumb == 'admin' && arg(0) == 'admin') {
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
$show_breadcrumb_home = theme_get_setting('zen_breadcrumb_home');
|
53 |
|
|
if (!$show_breadcrumb_home) {
|
54 |
|
|
array_shift($breadcrumb);
|
55 |
|
|
}
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
if (!empty($breadcrumb)) {
|
59 |
|
|
$breadcrumb_separator = filter_xss_admin(theme_get_setting('zen_breadcrumb_separator'));
|
60 |
|
|
$trailing_separator = $title = '';
|
61 |
|
|
if (theme_get_setting('zen_breadcrumb_title')) {
|
62 |
|
|
$item = menu_get_item();
|
63 |
|
|
if (!empty($item['tab_parent'])) {
|
64 |
|
|
|
65 |
|
|
$breadcrumb[] = check_plain($item['title']);
|
66 |
|
|
}
|
67 |
|
|
else {
|
68 |
|
|
$breadcrumb[] = drupal_get_title();
|
69 |
|
|
}
|
70 |
|
|
}
|
71 |
|
|
elseif (theme_get_setting('zen_breadcrumb_trailing')) {
|
72 |
|
|
$trailing_separator = $breadcrumb_separator;
|
73 |
|
|
}
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
if (empty($variables['title'])) {
|
78 |
|
|
$variables['title'] = t('You are here');
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
if (!isset($variables['title_attributes_array']['class'])) {
|
82 |
|
|
$variables['title_attributes_array']['class'][] = 'element-invisible';
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
$output = '<nav class="breadcrumb" role="navigation">';
|
87 |
|
|
$output .= '<h2' . drupal_attributes($variables['title_attributes_array']) . '>' . $variables['title'] . '</h2>';
|
88 |
|
|
$output .= '<ol><li>' . implode($breadcrumb_separator . '</li><li>', $breadcrumb) . $trailing_separator . '</li></ol>';
|
89 |
|
|
$output .= '</nav>';
|
90 |
|
|
}
|
91 |
|
|
}
|
92 |
|
|
|
93 |
|
|
return $output;
|
94 |
|
|
}
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
function zen_preprocess_html(&$variables, $hook) {
|
107 |
|
|
|
108 |
|
|
$variables['base_path'] = base_path();
|
109 |
|
|
$variables['path_to_zen'] = drupal_get_path('theme', 'zen');
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
$html5_respond_meta = array_filter((array) theme_get_setting('zen_html5_respond_meta'));
|
113 |
|
|
$variables['add_respond_js'] = in_array('respond', $html5_respond_meta);
|
114 |
|
|
$variables['add_html5_shim'] = in_array('html5', $html5_respond_meta);
|
115 |
|
|
$variables['default_mobile_metatags'] = in_array('meta', $html5_respond_meta);
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
if ($GLOBALS['theme'] == 'zen') {
|
119 |
|
|
include_once './' . $variables['path_to_zen'] . '/zen-internals/template.zen.inc';
|
120 |
|
|
_zen_preprocess_html($variables, $hook);
|
121 |
|
|
}
|
122 |
|
|
|
123 |
|
|
|
124 |
|
|
$variables['html_attributes_array'] = array(
|
125 |
|
|
'lang' => $variables['language']->language,
|
126 |
|
|
'dir' => $variables['language']->dir,
|
127 |
|
|
);
|
128 |
|
|
|
129 |
|
|
|
130 |
7e072189
|
Assos Assos
|
|
131 |
87dbc3bf
|
Benjamin Luce
|
|
132 |
|
|
|
133 |
|
|
if (is_null(drupal_get_http_header('X-UA-Compatible'))) {
|
134 |
7e072189
|
Assos Assos
|
drupal_add_http_header('X-UA-Compatible', 'IE=edge');
|
135 |
87dbc3bf
|
Benjamin Luce
|
}
|
136 |
|
|
|
137 |
|
|
$variables['skip_link_anchor'] = check_plain(theme_get_setting('zen_skip_link_anchor'));
|
138 |
|
|
$variables['skip_link_text'] = check_plain(theme_get_setting('zen_skip_link_text'));
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
if ($hook != 'html') {
|
142 |
|
|
return;
|
143 |
|
|
}
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
if ($variables['rdf_namespaces']) {
|
147 |
|
|
$prefixes = array();
|
148 |
|
|
foreach (explode("\n ", ltrim($variables['rdf_namespaces'])) as $namespace) {
|
149 |
|
|
|
150 |
|
|
$prefixes[] = str_replace('="', ': ', substr($namespace, 6, -1));
|
151 |
|
|
}
|
152 |
|
|
$variables['rdf_namespaces'] = ' prefix="' . implode(' ', $prefixes) . '"';
|
153 |
|
|
}
|
154 |
|
|
|
155 |
|
|
|
156 |
|
|
|
157 |
|
|
if (!$variables['is_front']) {
|
158 |
|
|
|
159 |
|
|
$path = drupal_get_path_alias($_GET['q']);
|
160 |
|
|
|
161 |
|
|
list($section, ) = explode('/', $path, 2);
|
162 |
|
|
$arg = explode('/', $_GET['q']);
|
163 |
|
|
if ($arg[0] == 'node' && isset($arg[1])) {
|
164 |
|
|
if ($arg[1] == 'add') {
|
165 |
|
|
$section = 'node-add';
|
166 |
|
|
}
|
167 |
|
|
elseif (isset($arg[2]) && is_numeric($arg[1]) && ($arg[2] == 'edit' || $arg[2] == 'delete')) {
|
168 |
|
|
$section = 'node-' . $arg[2];
|
169 |
|
|
}
|
170 |
|
|
}
|
171 |
|
|
$variables['classes_array'][] = drupal_html_class('section-' . $section);
|
172 |
|
|
}
|
173 |
|
|
if (theme_get_setting('zen_wireframes')) {
|
174 |
|
|
$variables['classes_array'][] = 'with-wireframes';
|
175 |
|
|
}
|
176 |
|
|
|
177 |
|
|
$variables['menu_item'] = menu_get_item();
|
178 |
|
|
if ($variables['menu_item']) {
|
179 |
|
|
switch ($variables['menu_item']['page_callback']) {
|
180 |
|
|
case 'views_page':
|
181 |
|
|
|
182 |
|
|
$variables['classes_array'][] = 'page-views';
|
183 |
|
|
break;
|
184 |
|
|
case 'page_manager_blog':
|
185 |
|
|
case 'page_manager_blog_user':
|
186 |
|
|
case 'page_manager_contact_site':
|
187 |
|
|
case 'page_manager_contact_user':
|
188 |
|
|
case 'page_manager_node_add':
|
189 |
|
|
case 'page_manager_node_edit':
|
190 |
|
|
case 'page_manager_node_view_page':
|
191 |
|
|
case 'page_manager_page_execute':
|
192 |
|
|
case 'page_manager_poll':
|
193 |
|
|
case 'page_manager_search_page':
|
194 |
|
|
case 'page_manager_term_view_page':
|
195 |
|
|
case 'page_manager_user_edit_page':
|
196 |
|
|
case 'page_manager_user_view_page':
|
197 |
|
|
|
198 |
|
|
$variables['classes_array'][] = 'page-panels';
|
199 |
|
|
break;
|
200 |
|
|
}
|
201 |
|
|
}
|
202 |
|
|
}
|
203 |
|
|
|
204 |
|
|
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
|
212 |
|
|
function zen_process_html(&$variables, $hook) {
|
213 |
|
|
|
214 |
|
|
$variables['html_attributes'] = drupal_attributes($variables['html_attributes_array']);
|
215 |
|
|
}
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
|
220 |
|
|
function zen_process_html_tag(&$variables) {
|
221 |
|
|
$tag = &$variables['element'];
|
222 |
|
|
|
223 |
|
|
if ($tag['#tag'] == 'style' || $tag['#tag'] == 'script') {
|
224 |
7e072189
|
Assos Assos
|
|
225 |
|
|
unset($tag['#value_prefix'], $tag['#value_suffix']);
|
226 |
|
|
|
227 |
|
|
|
228 |
|
|
if (isset($tag['#attributes']['type']) && $tag['#attributes']['type'] !== 'text/ng-template') {
|
229 |
|
|
unset($tag['#attributes']['type']);
|
230 |
|
|
}
|
231 |
87dbc3bf
|
Benjamin Luce
|
|
232 |
|
|
|
233 |
|
|
if (isset($tag['#attributes']['media']) && $tag['#attributes']['media'] === 'all') {
|
234 |
|
|
unset($tag['#attributes']['media']);
|
235 |
|
|
}
|
236 |
|
|
}
|
237 |
|
|
}
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
|
242 |
|
|
function zen_html_head_alter(&$head) {
|
243 |
|
|
|
244 |
|
|
if (isset($head['system_meta_content_type']['#attributes']['content'])) {
|
245 |
|
|
$head['system_meta_content_type']['#attributes'] = array('charset' => str_replace('text/html; charset=', '', $head['system_meta_content_type']['#attributes']['content']));
|
246 |
|
|
}
|
247 |
|
|
}
|
248 |
|
|
|
249 |
|
|
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
|
|
|
255 |
|
|
|
256 |
|
|
|
257 |
|
|
function zen_preprocess_page(&$variables, $hook) {
|
258 |
|
|
|
259 |
|
|
$secondary_links = variable_get('menu_secondary_links_source', 'user-menu');
|
260 |
|
|
if ($secondary_links) {
|
261 |
|
|
$menus = function_exists('menu_get_menus') ? menu_get_menus() : menu_list_system_menus();
|
262 |
7e072189
|
Assos Assos
|
$variables['secondary_menu_heading'] = isset($menus[$secondary_links]) ? $menus[$secondary_links] : '';
|
263 |
87dbc3bf
|
Benjamin Luce
|
}
|
264 |
|
|
else {
|
265 |
|
|
$variables['secondary_menu_heading'] = '';
|
266 |
|
|
}
|
267 |
|
|
}
|
268 |
|
|
|
269 |
|
|
|
270 |
|
|
|
271 |
|
|
|
272 |
|
|
|
273 |
|
|
|
274 |
|
|
|
275 |
|
|
|
276 |
|
|
|
277 |
|
|
function zen_preprocess_maintenance_page(&$variables, $hook) {
|
278 |
|
|
zen_preprocess_html($variables, $hook);
|
279 |
|
|
|
280 |
|
|
|
281 |
|
|
}
|
282 |
|
|
|
283 |
|
|
|
284 |
|
|
|
285 |
|
|
|
286 |
|
|
|
287 |
|
|
|
288 |
|
|
|
289 |
|
|
|
290 |
|
|
|
291 |
|
|
function zen_process_maintenance_page(&$variables, $hook) {
|
292 |
|
|
zen_process_html($variables, $hook);
|
293 |
|
|
|
294 |
|
|
|
295 |
|
|
foreach (array('header', 'navigation', 'highlighted', 'help', 'content', 'sidebar_first', 'sidebar_second', 'footer', 'bottom') as $region) {
|
296 |
|
|
if (!isset($variables[$region])) {
|
297 |
|
|
$variables[$region] = '';
|
298 |
|
|
}
|
299 |
|
|
}
|
300 |
|
|
}
|
301 |
|
|
|
302 |
|
|
|
303 |
|
|
|
304 |
|
|
|
305 |
|
|
|
306 |
|
|
|
307 |
|
|
|
308 |
|
|
|
309 |
|
|
|
310 |
|
|
function zen_preprocess_node(&$variables, $hook) {
|
311 |
|
|
|
312 |
|
|
$variables['unpublished'] = (!$variables['status']) ? TRUE : FALSE;
|
313 |
|
|
|
314 |
7e072189
|
Assos Assos
|
|
315 |
|
|
$variables['preview'] = isset($variables['preview']) ? $variables['preview'] : FALSE;
|
316 |
|
|
|
317 |
87dbc3bf
|
Benjamin Luce
|
|
318 |
|
|
$variables['pubdate'] = '<time pubdate datetime="' . format_date($variables['node']->created, 'custom', 'c') . '">' . $variables['date'] . '</time>';
|
319 |
|
|
if ($variables['display_submitted']) {
|
320 |
|
|
$variables['submitted'] = t('Submitted by !username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['pubdate']));
|
321 |
|
|
}
|
322 |
|
|
|
323 |
|
|
|
324 |
|
|
if (!$variables['teaser']) {
|
325 |
|
|
$variables['classes_array'][] = 'view-mode-' . $variables['view_mode'];
|
326 |
|
|
}
|
327 |
|
|
|
328 |
|
|
|
329 |
|
|
if ($variables['uid'] && $variables['uid'] == $GLOBALS['user']->uid) {
|
330 |
|
|
$variables['classes_array'][] = 'node-by-viewer';
|
331 |
|
|
}
|
332 |
|
|
|
333 |
|
|
$variables['title_attributes_array']['class'][] = 'node__title';
|
334 |
|
|
$variables['title_attributes_array']['class'][] = 'node-title';
|
335 |
|
|
}
|
336 |
|
|
|
337 |
|
|
|
338 |
|
|
|
339 |
|
|
|
340 |
|
|
|
341 |
|
|
|
342 |
|
|
|
343 |
|
|
|
344 |
|
|
|
345 |
|
|
function zen_preprocess_comment(&$variables, $hook) {
|
346 |
|
|
|
347 |
|
|
if (variable_get('comment_subject_field_' . $variables['node']->type, 1) == 0) {
|
348 |
|
|
$variables['title'] = '';
|
349 |
|
|
}
|
350 |
|
|
|
351 |
|
|
|
352 |
|
|
$variables['pubdate'] = '<time pubdate datetime="' . format_date($variables['comment']->created, 'custom', 'c') . '">' . $variables['created'] . '</time>';
|
353 |
|
|
$variables['submitted'] = t('!username replied on !datetime', array('!username' => $variables['author'], '!datetime' => $variables['pubdate']));
|
354 |
|
|
|
355 |
|
|
|
356 |
|
|
if ($variables['id'] == 1) {
|
357 |
|
|
$variables['classes_array'][] = 'first';
|
358 |
|
|
}
|
359 |
|
|
if ($variables['id'] == $variables['node']->comment_count) {
|
360 |
|
|
$variables['classes_array'][] = 'last';
|
361 |
|
|
}
|
362 |
|
|
$variables['classes_array'][] = $variables['zebra'];
|
363 |
|
|
|
364 |
|
|
$variables['title_attributes_array']['class'][] = 'comment__title';
|
365 |
|
|
$variables['title_attributes_array']['class'][] = 'comment-title';
|
366 |
|
|
}
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
|
370 |
|
|
|
371 |
|
|
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
|
375 |
|
|
|
376 |
|
|
function zen_preprocess_region(&$variables, $hook) {
|
377 |
|
|
|
378 |
|
|
if (strpos($variables['region'], 'sidebar_') === 0) {
|
379 |
|
|
$variables['classes_array'][] = 'column';
|
380 |
|
|
$variables['classes_array'][] = 'sidebar';
|
381 |
|
|
|
382 |
|
|
array_unshift($variables['theme_hook_suggestions'], 'region__sidebar');
|
383 |
|
|
}
|
384 |
|
|
|
385 |
|
|
elseif ($variables['region'] == 'content') {
|
386 |
|
|
|
387 |
|
|
array_unshift($variables['theme_hook_suggestions'], 'region__no_wrapper');
|
388 |
|
|
}
|
389 |
|
|
|
390 |
|
|
elseif ($variables['region'] == 'header') {
|
391 |
|
|
array_unshift($variables['classes_array'], 'header__region');
|
392 |
|
|
}
|
393 |
|
|
}
|
394 |
|
|
|
395 |
|
|
|
396 |
|
|
|
397 |
|
|
|
398 |
|
|
|
399 |
|
|
|
400 |
|
|
|
401 |
|
|
|
402 |
|
|
|
403 |
|
|
function zen_preprocess_block(&$variables, $hook) {
|
404 |
|
|
|
405 |
|
|
if ($variables['block_html_id'] == 'block-system-main') {
|
406 |
|
|
$variables['theme_hook_suggestions'][] = 'block__no_wrapper';
|
407 |
|
|
}
|
408 |
|
|
|
409 |
|
|
|
410 |
|
|
if ($variables['block_id'] == 1) {
|
411 |
|
|
$variables['classes_array'][] = 'first';
|
412 |
|
|
}
|
413 |
|
|
|
414 |
|
|
if (isset($variables['block']->last_in_region)) {
|
415 |
|
|
$variables['classes_array'][] = 'last';
|
416 |
|
|
}
|
417 |
|
|
$variables['classes_array'][] = $variables['block_zebra'];
|
418 |
|
|
|
419 |
|
|
$variables['title_attributes_array']['class'][] = 'block__title';
|
420 |
|
|
$variables['title_attributes_array']['class'][] = 'block-title';
|
421 |
|
|
|
422 |
|
|
|
423 |
|
|
switch ($variables['block']->module) {
|
424 |
|
|
case 'system':
|
425 |
|
|
switch ($variables['block']->delta) {
|
426 |
|
|
case 'main':
|
427 |
|
|
|
428 |
|
|
break;
|
429 |
|
|
case 'help':
|
430 |
|
|
case 'powered-by':
|
431 |
|
|
$variables['attributes_array']['role'] = 'complementary';
|
432 |
|
|
break;
|
433 |
|
|
default:
|
434 |
|
|
|
435 |
|
|
$variables['attributes_array']['role'] = 'navigation';
|
436 |
|
|
break;
|
437 |
|
|
}
|
438 |
|
|
break;
|
439 |
|
|
case 'menu':
|
440 |
|
|
case 'menu_block':
|
441 |
|
|
case 'blog':
|
442 |
|
|
case 'book':
|
443 |
|
|
case 'comment':
|
444 |
|
|
case 'forum':
|
445 |
|
|
case 'shortcut':
|
446 |
|
|
case 'statistics':
|
447 |
|
|
$variables['attributes_array']['role'] = 'navigation';
|
448 |
|
|
break;
|
449 |
|
|
case 'search':
|
450 |
|
|
$variables['attributes_array']['role'] = 'search';
|
451 |
|
|
break;
|
452 |
|
|
case 'help':
|
453 |
|
|
case 'aggregator':
|
454 |
|
|
case 'locale':
|
455 |
|
|
case 'poll':
|
456 |
|
|
case 'profile':
|
457 |
|
|
$variables['attributes_array']['role'] = 'complementary';
|
458 |
|
|
break;
|
459 |
|
|
case 'node':
|
460 |
|
|
switch ($variables['block']->delta) {
|
461 |
|
|
case 'syndicate':
|
462 |
|
|
$variables['attributes_array']['role'] = 'complementary';
|
463 |
|
|
break;
|
464 |
|
|
case 'recent':
|
465 |
|
|
$variables['attributes_array']['role'] = 'navigation';
|
466 |
|
|
break;
|
467 |
|
|
}
|
468 |
|
|
break;
|
469 |
|
|
case 'user':
|
470 |
|
|
switch ($variables['block']->delta) {
|
471 |
|
|
case 'login':
|
472 |
|
|
$variables['attributes_array']['role'] = 'form';
|
473 |
|
|
break;
|
474 |
|
|
case 'new':
|
475 |
|
|
case 'online':
|
476 |
|
|
$variables['attributes_array']['role'] = 'complementary';
|
477 |
|
|
break;
|
478 |
|
|
}
|
479 |
|
|
break;
|
480 |
|
|
}
|
481 |
|
|
}
|
482 |
|
|
|
483 |
|
|
|
484 |
|
|
|
485 |
|
|
|
486 |
|
|
|
487 |
|
|
|
488 |
|
|
|
489 |
|
|
|
490 |
|
|
|
491 |
|
|
function zen_process_block(&$variables, $hook) {
|
492 |
|
|
|
493 |
|
|
$variables['title'] = isset($variables['block']->subject) ? $variables['block']->subject : '';
|
494 |
|
|
}
|
495 |
|
|
|
496 |
|
|
|
497 |
|
|
|
498 |
|
|
|
499 |
|
|
|
500 |
|
|
|
501 |
|
|
|
502 |
|
|
|
503 |
|
|
|
504 |
|
|
|
505 |
|
|
function zen_page_alter(&$page) {
|
506 |
|
|
|
507 |
|
|
foreach (system_region_list($GLOBALS['theme'], REGIONS_VISIBLE) as $region => $name) {
|
508 |
|
|
if (!empty($page[$region])) {
|
509 |
|
|
|
510 |
|
|
$blocks = array_reverse(element_children($page[$region]));
|
511 |
|
|
while ($blocks && !isset($page[$region][$blocks[0]]['#block'])) {
|
512 |
|
|
array_shift($blocks);
|
513 |
|
|
}
|
514 |
|
|
if ($blocks) {
|
515 |
|
|
$page[$region][$blocks[0]]['#block']->last_in_region = TRUE;
|
516 |
|
|
}
|
517 |
|
|
}
|
518 |
|
|
}
|
519 |
|
|
}
|
520 |
|
|
|
521 |
|
|
|
522 |
|
|
|
523 |
|
|
|
524 |
|
|
|
525 |
|
|
|
526 |
|
|
|
527 |
|
|
function zen_form_node_form_alter(&$form, &$form_state, $form_id) {
|
528 |
|
|
|
529 |
|
|
foreach (array_keys($form) as $item) {
|
530 |
|
|
if (strpos($item, 'field_') === 0) {
|
531 |
|
|
if (!empty($form[$item]['#attributes']['class'])) {
|
532 |
|
|
foreach ($form[$item]['#attributes']['class'] as &$class) {
|
533 |
|
|
|
534 |
|
|
if ($class != 'field-type-text-with-summary' && strpos($class, 'field-type-') === 0 || strpos($class, 'field-name-') === 0) {
|
535 |
|
|
|
536 |
|
|
$class = 'form-' . $class;
|
537 |
|
|
}
|
538 |
|
|
}
|
539 |
|
|
}
|
540 |
|
|
}
|
541 |
|
|
}
|
542 |
|
|
}
|
543 |
|
|
|
544 |
|
|
|
545 |
|
|
|
546 |
|
|
|
547 |
|
|
|
548 |
|
|
|
549 |
|
|
function zen_menu_local_tasks(&$variables) {
|
550 |
|
|
$output = '';
|
551 |
|
|
|
552 |
|
|
|
553 |
|
|
foreach (array('primary', 'secondary') as $type) {
|
554 |
|
|
if (!empty($variables[$type])) {
|
555 |
|
|
foreach (array_keys($variables[$type]) as $key) {
|
556 |
|
|
if (isset($variables[$type][$key]['#theme']) && ($variables[$type][$key]['#theme'] == 'menu_local_task' || is_array($variables[$type][$key]['#theme']) && in_array('menu_local_task', $variables[$type][$key]['#theme']))) {
|
557 |
|
|
$variables[$type][$key]['#theme'] = array('menu_local_task__' . $type, 'menu_local_task');
|
558 |
|
|
}
|
559 |
|
|
}
|
560 |
|
|
}
|
561 |
|
|
}
|
562 |
|
|
|
563 |
|
|
if (!empty($variables['primary'])) {
|
564 |
|
|
$variables['primary']['#prefix'] = '<h2 class="element-invisible">' . t('Primary tabs') . '</h2>';
|
565 |
|
|
$variables['primary']['#prefix'] .= '<ul class="tabs-primary tabs primary">';
|
566 |
|
|
$variables['primary']['#suffix'] = '</ul>';
|
567 |
|
|
$output .= drupal_render($variables['primary']);
|
568 |
|
|
}
|
569 |
|
|
if (!empty($variables['secondary'])) {
|
570 |
|
|
$variables['secondary']['#prefix'] = '<h2 class="element-invisible">' . t('Secondary tabs') . '</h2>';
|
571 |
|
|
$variables['secondary']['#prefix'] .= '<ul class="tabs-secondary tabs secondary">';
|
572 |
|
|
$variables['secondary']['#suffix'] = '</ul>';
|
573 |
|
|
$output .= drupal_render($variables['secondary']);
|
574 |
|
|
}
|
575 |
|
|
|
576 |
|
|
return $output;
|
577 |
|
|
}
|
578 |
|
|
|
579 |
|
|
|
580 |
|
|
|
581 |
|
|
|
582 |
|
|
|
583 |
|
|
|
584 |
|
|
function zen_menu_local_task($variables) {
|
585 |
|
|
$type = $class = FALSE;
|
586 |
|
|
|
587 |
|
|
$link = $variables['element']['#link'];
|
588 |
|
|
$link_text = $link['title'];
|
589 |
|
|
|
590 |
|
|
|
591 |
|
|
if (is_array($variables['element']['#theme'])) {
|
592 |
|
|
$type = in_array('menu_local_task__secondary', $variables['element']['#theme']) ? 'tabs-secondary' : 'tabs-primary';
|
593 |
|
|
}
|
594 |
|
|
|
595 |
|
|
|
596 |
|
|
if ($type) {
|
597 |
|
|
$link['localized_options']['attributes']['class'][] = $type . '__tab-link';
|
598 |
|
|
$class = $type . '__tab';
|
599 |
|
|
}
|
600 |
|
|
|
601 |
|
|
if (!empty($variables['element']['#active'])) {
|
602 |
|
|
|
603 |
|
|
$active = ' <span class="element-invisible">' . t('(active tab)') . '</span>';
|
604 |
|
|
|
605 |
|
|
|
606 |
|
|
|
607 |
|
|
if (empty($link['localized_options']['html'])) {
|
608 |
|
|
$link['title'] = check_plain($link['title']);
|
609 |
|
|
}
|
610 |
|
|
$link['localized_options']['html'] = TRUE;
|
611 |
|
|
$link_text = t('!local-task-title!active', array('!local-task-title' => $link['title'], '!active' => $active));
|
612 |
|
|
|
613 |
|
|
if (!$type) {
|
614 |
|
|
$class = 'active';
|
615 |
|
|
}
|
616 |
|
|
else {
|
617 |
|
|
$link['localized_options']['attributes']['class'][] = 'is-active';
|
618 |
|
|
$class .= ' is-active';
|
619 |
|
|
}
|
620 |
|
|
}
|
621 |
|
|
|
622 |
|
|
return '<li' . ($class ? ' class="' . $class . '"' : '') . '>' . l($link_text, $link['href'], $link['localized_options']) . "</li>\n";
|
623 |
|
|
}
|
624 |
|
|
|
625 |
|
|
|
626 |
|
|
|
627 |
|
|
|
628 |
|
|
function zen_preprocess_menu_link(&$variables, $hook) {
|
629 |
7e072189
|
Assos Assos
|
|
630 |
|
|
if (empty($variables['element']['#attributes']['class'])) {
|
631 |
|
|
$variables['element']['#attributes']['class'] = array();
|
632 |
|
|
}
|
633 |
|
|
$menu_item_classes =& $variables['element']['#attributes']['class'];
|
634 |
|
|
if (!is_array($menu_item_classes)) {
|
635 |
|
|
$menu_item_classes = array($menu_item_classes);
|
636 |
|
|
}
|
637 |
|
|
|
638 |
|
|
|
639 |
|
|
if (empty($variables['element']['#localized_options']['attributes']['class'])) {
|
640 |
|
|
$variables['element']['#localized_options']['attributes']['class'] = array();
|
641 |
|
|
}
|
642 |
|
|
$menu_link_classes =& $variables['element']['#localized_options']['attributes']['class'];
|
643 |
|
|
if (!is_array($menu_link_classes)) {
|
644 |
|
|
$menu_link_classes = array($menu_link_classes);
|
645 |
|
|
}
|
646 |
|
|
|
647 |
|
|
|
648 |
|
|
$extra_classes = array('menu__item');
|
649 |
|
|
foreach ($menu_item_classes as $key => $class) {
|
650 |
87dbc3bf
|
Benjamin Luce
|
switch ($class) {
|
651 |
|
|
|
652 |
|
|
case 'expanded':
|
653 |
|
|
case 'collapsed':
|
654 |
|
|
case 'leaf':
|
655 |
|
|
case 'active':
|
656 |
|
|
|
657 |
|
|
case 'active-trail':
|
658 |
7e072189
|
Assos Assos
|
$extra_classes[] = 'is-' . $class;
|
659 |
87dbc3bf
|
Benjamin Luce
|
break;
|
660 |
|
|
case 'has-children':
|
661 |
7e072189
|
Assos Assos
|
$extra_classes[] = 'is-parent';
|
662 |
87dbc3bf
|
Benjamin Luce
|
break;
|
663 |
|
|
}
|
664 |
|
|
}
|
665 |
7e072189
|
Assos Assos
|
$menu_item_classes = array_merge($extra_classes, $menu_item_classes);
|
666 |
|
|
|
667 |
|
|
|
668 |
|
|
$extra_classes = array('menu__link');
|
669 |
|
|
if (empty($menu_link_classes)) {
|
670 |
|
|
$menu_link_classes = array();
|
671 |
87dbc3bf
|
Benjamin Luce
|
}
|
672 |
|
|
else {
|
673 |
7e072189
|
Assos Assos
|
foreach ($menu_link_classes as $key => $class) {
|
674 |
87dbc3bf
|
Benjamin Luce
|
switch ($class) {
|
675 |
|
|
case 'active':
|
676 |
|
|
case 'active-trail':
|
677 |
7e072189
|
Assos Assos
|
$extra_classes[] = 'is-' . $class;
|
678 |
87dbc3bf
|
Benjamin Luce
|
break;
|
679 |
|
|
}
|
680 |
|
|
}
|
681 |
|
|
}
|
682 |
7e072189
|
Assos Assos
|
$menu_link_classes = array_merge($extra_classes, $menu_link_classes);
|
683 |
87dbc3bf
|
Benjamin Luce
|
}
|
684 |
|
|
|
685 |
|
|
|
686 |
|
|
|
687 |
|
|
|
688 |
|
|
function zen_status_messages($variables) {
|
689 |
|
|
$display = $variables['display'];
|
690 |
|
|
$output = '';
|
691 |
|
|
|
692 |
|
|
$status_heading = array(
|
693 |
|
|
'status' => t('Status message'),
|
694 |
|
|
'error' => t('Error message'),
|
695 |
|
|
'warning' => t('Warning message'),
|
696 |
|
|
);
|
697 |
|
|
foreach (drupal_get_messages($display) as $type => $messages) {
|
698 |
|
|
$output .= "<div class=\"messages--$type messages $type\">\n";
|
699 |
|
|
if (!empty($status_heading[$type])) {
|
700 |
|
|
$output .= '<h2 class="element-invisible">' . $status_heading[$type] . "</h2>\n";
|
701 |
|
|
}
|
702 |
|
|
if (count($messages) > 1) {
|
703 |
|
|
$output .= " <ul class=\"messages__list\">\n";
|
704 |
|
|
foreach ($messages as $message) {
|
705 |
7e072189
|
Assos Assos
|
$output .= ' <li class="messages__item">' . $message . "</li>\n";
|
706 |
87dbc3bf
|
Benjamin Luce
|
}
|
707 |
|
|
$output .= " </ul>\n";
|
708 |
|
|
}
|
709 |
|
|
else {
|
710 |
7e072189
|
Assos Assos
|
$output .= reset($messages);
|
711 |
87dbc3bf
|
Benjamin Luce
|
}
|
712 |
|
|
$output .= "</div>\n";
|
713 |
|
|
}
|
714 |
|
|
return $output;
|
715 |
|
|
}
|
716 |
|
|
|
717 |
|
|
|
718 |
|
|
|
719 |
|
|
|
720 |
|
|
function zen_mark($variables) {
|
721 |
|
|
$type = $variables['type'];
|
722 |
|
|
|
723 |
|
|
if ($type == MARK_NEW) {
|
724 |
|
|
return ' <mark class="new">' . t('new') . '</mark>';
|
725 |
|
|
}
|
726 |
|
|
elseif ($type == MARK_UPDATED) {
|
727 |
|
|
return ' <mark class="updated">' . t('updated') . '</mark>';
|
728 |
|
|
}
|
729 |
|
|
}
|
730 |
|
|
|
731 |
|
|
|
732 |
|
|
|
733 |
|
|
|
734 |
|
|
function zen_panels_default_style_render_region($variables) {
|
735 |
|
|
return implode('', $variables['panes']);
|
736 |
|
|
} |