Révision 74f6bef0
Ajouté par Assos Assos il y a plus de 10 ans
drupal7/sites/all/themes/adaptivetheme/at_core/inc/theme.inc | ||
---|---|---|
66 | 66 |
/** |
67 | 67 |
* Returns HTML for a breadcrumb trail. |
68 | 68 |
* |
69 |
* Adaptivetheme impliments breadcrumb trails as an ordered list, wrapping each
|
|
70 |
* crumb in li elements and the seperators in span elements to make life easier
|
|
71 |
* for themers. Additionally .crumb, .crumb-first and .crumb-last classes are
|
|
72 |
* printed on the li elements.
|
|
69 |
* Adaptivetheme renders breadcrumbs as an ordered list (<ol>...</ol>), wrapping
|
|
70 |
* crumbs in li elements and the seperators in span elements. Additionally .crumb,
|
|
71 |
* .crumb-first and .crumb-last classes are printed on the li elements. We also
|
|
72 |
* remove some silly breadcrumbs from various pages.
|
|
73 | 73 |
* |
74 | 74 |
* @param $vars |
75 | 75 |
* An associative array containing: |
... | ... | |
78 | 78 |
function adaptivetheme_breadcrumb($vars) { |
79 | 79 |
global $theme_key; |
80 | 80 |
$theme_name = $theme_key; |
81 |
|
|
82 | 81 |
$breadcrumb = $vars['breadcrumb']; |
83 | 82 |
|
84 | 83 |
if (at_get_setting('breadcrumb_display', $theme_name) == 1) { |
... | ... | |
88 | 87 |
} |
89 | 88 |
|
90 | 89 |
// Remove the rather pointless breadcrumbs for reset password and user |
91 |
// register pages, they link to the page you are on.
|
|
90 |
// register pages, they link to the page you are on, doh!
|
|
92 | 91 |
if (arg(0) === 'user' && (arg(1) === 'password' || arg(1) === 'register')) { |
93 | 92 |
array_pop($breadcrumb); |
94 | 93 |
} |
... | ... | |
99 | 98 |
|
100 | 99 |
// Push the page title onto the end of the breadcrumb array |
101 | 100 |
if (at_get_setting('breadcrumb_title', $theme_name) == 1) { |
102 |
$breadcrumb[] = '<span class="crumb-title">' . drupal_get_title() . '</span>'; |
|
101 |
if ($page_title = drupal_get_title()) { |
|
102 |
$breadcrumb[] = '<span class="crumb-title">' . $page_title . '</span>'; |
|
103 |
} |
|
103 | 104 |
} |
104 | 105 |
|
105 | 106 |
$class = 'crumb'; |
... | ... | |
108 | 109 |
|
109 | 110 |
$output = ''; |
110 | 111 |
if (at_get_setting('breadcrumb_label', $theme_name) == 1) { |
111 |
$output = '<div id="breadcrumb" class="clearfix"><nav class="breadcrumb-wrapper with-breadcrumb-label clearfix" role="navigation">'; |
|
112 |
$output .= '<h2 class="breadcrumb-label">' . t('You are here') . '</h2>'; |
|
112 |
$output = '<div id="breadcrumb" class="clearfix"><nav class="breadcrumb-wrapper with-breadcrumb-label clearfix" role="navigation" aria-labelledby="breadcrumb-label">';
|
|
113 |
$output .= '<h2 id="breadcrumb-label" class="breadcrumb-label">' . t('You are here') . '</h2>';
|
|
113 | 114 |
} |
114 | 115 |
else { |
115 |
$output = '<div id="breadcrumb" class="clearfix"><nav class="breadcrumb-wrapper clearfix" role="navigation">'; |
|
116 |
$output .= '<h2 class="element-invisible">' . t('You are here') . '</h2>'; |
|
116 |
$output = '<div id="breadcrumb" class="clearfix"><nav class="breadcrumb-wrapper clearfix" role="navigation" aria-labelledby="breadcrumb-label">';
|
|
117 |
$output .= '<h2 id="breadcrumb-label" class="element-invisible">' . t('You are here') . '</h2>';
|
|
117 | 118 |
} |
118 | 119 |
$output .= '<ol id="crumbs" class="clearfix">'; |
119 |
foreach ($breadcrumb as $key => $val) {
|
|
120 |
foreach ($breadcrumb as $key => $crumb) {
|
|
120 | 121 |
if ($key == $last && count($breadcrumb) != 1) { |
121 | 122 |
$class = 'crumb crumb-last'; |
122 | 123 |
} |
123 | 124 |
if ($key == 0) { |
124 |
$output .= '<li class="' . $class . ' crumb-first">' . $val . '</li>';
|
|
125 |
$output .= '<li class="' . $class . ' crumb-first">' . $crumb . '</li>';
|
|
125 | 126 |
} |
126 | 127 |
else { |
127 |
$output .= '<li class="' . $class . '"><span class="crumb-sepreator">' . $separator . '</span>' . $val . '</li>';
|
|
128 |
$output .= '<li class="' . $class . '"><span class="crumb-separator">' . $separator . '</span>' . $crumb . '</li>';
|
|
128 | 129 |
} |
129 | 130 |
} |
130 | 131 |
$output .= '</ol></nav></div>'; |
... | ... | |
152 | 153 |
* of that type. |
153 | 154 |
*/ |
154 | 155 |
function adaptivetheme_status_messages($vars) { |
155 |
$display = $vars['display'];
|
|
156 |
$display = drupal_get_messages($vars['display']);
|
|
156 | 157 |
$output = ''; |
157 | 158 |
|
158 |
$status_heading = array( |
|
159 |
'status' => t('Status message'), |
|
160 |
'error' => t('Error message'), |
|
161 |
'warning' => t('Warning message'), |
|
162 |
); |
|
163 |
foreach (drupal_get_messages($display) as $type => $messages) { |
|
164 |
$output .= "<div id=\"messages\"><div class=\"messages $type\">"; |
|
165 |
if (!empty($status_heading[$type])) { |
|
166 |
$output .= '<h2 class="element-invisible">' . $status_heading[$type] . "</h2>"; |
|
167 |
} |
|
168 |
if (count($messages) > 1) { |
|
169 |
$output .= " <ul>"; |
|
170 |
foreach ($messages as $message) { |
|
171 |
$output .= ' <li>' . $message . "</li>"; |
|
159 |
if (count($display) > 0) { |
|
160 |
$status_heading = array( |
|
161 |
'status' => t('Status message'), |
|
162 |
'error' => t('Error message'), |
|
163 |
'warning' => t('Warning message'), |
|
164 |
); |
|
165 |
foreach ($display as $type => $messages) { |
|
166 |
$output .= "<div class=\"messages $type\">"; |
|
167 |
if (!empty($status_heading[$type])) { |
|
168 |
$output .= '<h2 class="element-invisible">' . $status_heading[$type] . "</h2>"; |
|
169 |
} |
|
170 |
if (count($messages) > 1) { |
|
171 |
$output .= " <ul>"; |
|
172 |
foreach ($messages as $message) { |
|
173 |
$output .= ' <li class="message-item">' . $message . "</li>"; |
|
174 |
} |
|
175 |
$output .= " </ul>"; |
|
176 |
} |
|
177 |
else { |
|
178 |
$output .= $messages[0]; |
|
172 | 179 |
} |
173 |
$output .= " </ul>";
|
|
180 |
$output .= "</div>";
|
|
174 | 181 |
} |
175 |
else {
|
|
176 |
$output .= $messages[0];
|
|
182 |
if ($output != ''){
|
|
183 |
$output = "<div id=\"messages\">" . $output . "</div>";
|
|
177 | 184 |
} |
178 |
$output .= "</div></div>"; |
|
179 | 185 |
} |
186 |
|
|
180 | 187 |
return $output; |
181 | 188 |
} |
182 | 189 |
|
... | ... | |
207 | 214 |
$type = $vars['type']; |
208 | 215 |
$attributes = $vars['attributes']; |
209 | 216 |
|
210 |
$output = '<div class="item-list">'; |
|
217 |
// If a class exists use it on the wrapper, for Drupal core this mainly applies |
|
218 |
// to the pager, so you get the wrapper class .item-list-pager |
|
219 |
if (isset($attributes['class'])) { |
|
220 |
$output = '<div class="item-list item-list-' . $attributes['class'][0] . '">'; |
|
221 |
} |
|
222 |
else { |
|
223 |
$output = '<div class="item-list">'; |
|
224 |
} |
|
211 | 225 |
|
212 | 226 |
if (isset($title) && $title !== '') { |
213 | 227 |
$output .= '<h3>' . $title . '</h3>'; |
... | ... | |
219 | 233 |
foreach ($items as $i => $item) { |
220 | 234 |
$attributes = array(); |
221 | 235 |
$children = array(); |
236 |
$data = ''; |
|
222 | 237 |
if (is_array($item)) { |
223 | 238 |
foreach ($item as $key => $value) { |
224 | 239 |
if ($key == 'data') { |
... | ... | |
316 | 331 |
$element['#localized_options']['html'] = TRUE; |
317 | 332 |
} |
318 | 333 |
|
319 |
if (at_get_setting('unset_menu_titles', $theme_name) == 1 && !empty($element['#localized_options']['attributes']['title'])) {
|
|
334 |
if (at_get_setting('unset_menu_titles', $theme_name) == 1 /* && !empty($element['#localized_options']['attributes']['title']) */) {
|
|
320 | 335 |
unset($element['#localized_options']['attributes']['title']); |
321 | 336 |
} |
322 | 337 |
|
338 |
// Possible feature to show menu descriptions in span elements |
|
339 |
//if ($element['#original_link']['menu_name'] == "main-menu" && isset($element['#localized_options']['attributes']['title'])){ |
|
340 |
// $element['#title'] = '<span class="title">' . $element['#title'] . '</span>'; |
|
341 |
// $element['#title'] .= '<span class="description">' . $element['#localized_options']['attributes']['title'] . '</span>'; |
|
342 |
// $element['#localized_options']['html'] = TRUE; |
|
343 |
//} |
|
344 |
|
|
323 | 345 |
$output = l($element['#title'], $element['#href'], $element['#localized_options']); |
324 | 346 |
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>"; |
325 | 347 |
} |
... | ... | |
381 | 403 |
if (!empty($heading['class'])) { |
382 | 404 |
$output .= drupal_attributes(array('class' => $heading['class'])); |
383 | 405 |
} |
406 |
if (!empty($heading['id'])) { |
|
407 |
$output .= drupal_attributes(array('id' => $heading['id'])); |
|
408 |
} |
|
384 | 409 |
$output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>'; |
385 | 410 |
} |
386 | 411 |
|
... | ... | |
389 | 414 |
$i = 1; |
390 | 415 |
|
391 | 416 |
foreach ($links as $key => $link) { |
417 |
|
|
418 |
// Extra menu classes |
|
392 | 419 |
if (at_get_setting('extra_menu_classes')) { |
393 | 420 |
$class = array($key); |
394 |
} |
|
395 |
if (at_get_setting('extra_menu_classes')) { |
|
396 | 421 |
if ($i == 1) { |
397 | 422 |
$class[] = 'first'; |
398 | 423 |
} |
399 | 424 |
if ($i == $num_links) { |
400 | 425 |
$class[] = 'last'; |
401 | 426 |
} |
402 |
} |
|
403 |
if (at_get_setting('extra_menu_classes')) { |
|
404 | 427 |
if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page())) |
405 | 428 |
&& (empty($link['language']) || $link['language']->language == $language_url->language)) { |
406 | 429 |
$class[] = 'active'; |
407 | 430 |
} |
408 |
} |
|
409 |
if (at_get_setting('extra_menu_classes')) { |
|
410 | 431 |
$output .= '<li' . drupal_attributes(array('class' => $class)) . '>'; |
411 | 432 |
} |
412 | 433 |
else { |
413 | 434 |
$output .= '<li>'; |
414 | 435 |
} |
436 |
|
|
415 | 437 |
if (isset($link['href'])) { |
416 | 438 |
if (at_get_setting('menu_item_span_elements')) { |
417 | 439 |
$link['title'] = '<span>' . $link['title'] . '</span>'; |
... | ... | |
624 | 646 |
|
625 | 647 |
return $output; |
626 | 648 |
} |
649 |
|
|
650 |
|
|
651 |
/** |
|
652 |
* Table no_striping boilerplate. |
|
653 |
*/ |
|
654 |
/* |
|
655 |
function adaptivetheme_preprocess_table(&$variables) { |
|
656 |
$rows = $variables['rows']; |
|
657 |
foreach ($rows as $number => $row) { |
|
658 |
$variables['rows'][$number]['no_striping'] = TRUE; |
|
659 |
} |
|
660 |
} |
|
661 |
*/ |
Formats disponibles : Unified diff
Weekly update of contrib modules