Révision 74f6bef0
Ajouté par Assos Assos il y a plus de 10 ans
drupal7/sites/all/themes/adaptivetheme/at_core/inc/generate.inc | ||
---|---|---|
12 | 12 |
* @param $vars, passed in the adaptivetheme_preprocess_html() |
13 | 13 |
* @param $theme_name, the active theme. |
14 | 14 |
*/ |
15 |
function generate_html_classes(&$vars, $theme_name) { |
|
15 |
function at_generate_html_classes(&$vars, $theme_name) {
|
|
16 | 16 |
$classes_array = &drupal_static(__FUNCTION__, array()); |
17 | 17 |
if (empty($classes_array)) { |
18 | 18 |
|
... | ... | |
30 | 30 |
$classes_array[] = 'debug-panels'; |
31 | 31 |
} |
32 | 32 |
|
33 |
// Base theme classes, I use these to aid in debugging clients themes, you |
|
34 |
// could use them to hook a specific minor version. Note that version is |
|
35 |
// only included in Drupal.org archives, its missing when you clone GIT. |
|
36 |
$info = at_get_info('adaptivetheme'); |
|
37 |
if (isset($info['release'])) { |
|
38 |
$classes_array[] = 'atr-' . $info['release']; |
|
39 |
} |
|
40 |
if (isset($info['version'])) { |
|
41 |
$classes_array[] = 'atv-' . $info['version']; |
|
42 |
} |
|
43 |
|
|
33 | 44 |
// Extra Classes |
34 | 45 |
if (at_get_setting('extra_page_classes', $theme_name) === 1) { |
35 | 46 |
|
... | ... | |
45 | 56 |
$classes_array[] = 'site-name-' . drupal_html_class($head_title); |
46 | 57 |
} |
47 | 58 |
|
48 |
// Classes for theming based on context
|
|
59 |
// Classes for theming based on section
|
|
49 | 60 |
if (!$vars['is_front']) { |
50 |
// Add unique class for each page. |
|
51 |
$path = drupal_get_path_alias($_GET['q']); |
|
52 |
// Add unique class for each website section. |
|
61 |
$path = drupal_get_path_alias(check_plain($_GET['q'])); |
|
53 | 62 |
list($section, ) = explode('/', $path, 2); |
54 |
$arg = explode('/', $_GET['q']); |
|
55 |
if ($arg[0] === 'node') { |
|
56 |
if (isset($arg[1]) && $arg[1] === 'add') { |
|
57 |
$section = 'node-add'; |
|
58 |
} |
|
59 |
elseif (isset($arg[2]) && is_numeric($arg[1]) && ($arg[2] === 'edit' || $arg[2] === 'delete')) { |
|
60 |
$section = 'node-' . $arg[2]; |
|
61 |
} |
|
62 |
} |
|
63 |
$section = check_plain($section); |
|
64 | 63 |
$classes_array[] = drupal_html_class('section-' . $section); |
65 | 64 |
} |
66 | 65 |
} |
... | ... | |
90 | 89 |
* @param $vars, passed in the adaptivetheme_preprocess_page() |
91 | 90 |
* @param $theme_name, the active theme. |
92 | 91 |
*/ |
93 |
function generate_page_classes(&$vars, $theme_name) { |
|
92 |
function at_generate_page_classes(&$vars, $theme_name) {
|
|
94 | 93 |
$classes_array = &drupal_static(__FUNCTION__, array()); |
95 | 94 |
if (empty($classes_array)) { |
96 | 95 |
|
... | ... | |
189 | 188 |
} |
190 | 189 |
} |
191 | 190 |
} |
191 |
|
|
192 |
// Page class for at menu toggle |
|
193 |
if (at_get_setting('enable_menu_toggle', $theme_name) === 1) { |
|
194 |
$classes_array[] = 'at-mt'; |
|
195 |
} |
|
192 | 196 |
} |
193 | 197 |
|
194 | 198 |
return $classes_array; |
... | ... | |
198 | 202 |
* Add classes for platforms and browsers. |
199 | 203 |
* This is very simple and can never replace something like WURFL or Mobile |
200 | 204 |
* Smart, in the future I intend to build a module to replace this. |
205 |
* Note - this is too dangerous to namespace since legacy themes use it. |
|
201 | 206 |
* |
202 | 207 |
* @param null $ua |
203 | 208 |
*/ |
... | ... | |
313 | 318 |
* load a body class for the active color scheme, very useful for CSS tweaks |
314 | 319 |
* required for a particular scheme. This is not enabled by default, you have to |
315 | 320 |
* call it in template_preprocess_html(). Mostly ripped from Color module. |
321 |
* Note - this is too dangerous to namespace since legacy themes use it. |
|
316 | 322 |
* |
317 | 323 |
* @param $theme_name |
318 | 324 |
*/ |
319 | 325 |
function get_color_scheme_name($theme_name) { |
320 |
$scheme_name = drupal_static(__FUNCTION__, array()); |
|
326 |
$scheme_name = &drupal_static(__FUNCTION__, array());
|
|
321 | 327 |
if (empty($scheme_name)) { |
322 | 328 |
if (module_exists('color')) { |
323 | 329 |
|
... | ... | |
350 | 356 |
|
351 | 357 |
return $scheme_name; |
352 | 358 |
} |
359 |
|
|
360 |
/** |
|
361 |
* Generate default classes for Panels layouts |
|
362 |
* Done because for some unknown reason setting these |
|
363 |
* in template_preprocess does not work, aka the variable |
|
364 |
* does not appear in the panel layout preprocess function. |
|
365 |
*/ |
|
366 |
function at_panels_classes_array() { |
|
367 |
$output = array( |
|
368 |
'at-panel', |
|
369 |
'panel-display', |
|
370 |
'clearfix', |
|
371 |
); |
|
372 |
|
|
373 |
return $output; |
|
374 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules