root / drupal7 / sites / all / themes / corolla / template.php @ b1ab1c0c
1 |
<?php
|
---|---|
2 |
// Corolla by Adaptivethemes.com
|
3 |
|
4 |
/**
|
5 |
* Override or insert vars into the html template.
|
6 |
*/
|
7 |
function corolla_preprocess_html(&$vars) { |
8 |
global $theme_key; |
9 |
$theme_name = $theme_key; |
10 |
|
11 |
// Add a class for the active color scheme
|
12 |
if (module_exists('color')) { |
13 |
$class = check_plain(get_color_scheme_name($theme_name)); |
14 |
$vars['classes_array'][] = 'color-scheme-' . drupal_html_class($class); |
15 |
} |
16 |
|
17 |
// Add class for the active theme
|
18 |
$vars['classes_array'][] = drupal_html_class($theme_name); |
19 |
|
20 |
// Add theme settings classes
|
21 |
$settings_array = array( |
22 |
'box_shadows',
|
23 |
'body_background',
|
24 |
'menu_bullets',
|
25 |
'content_corner_radius',
|
26 |
'tabs_corner_radius',
|
27 |
); |
28 |
foreach ($settings_array as $setting) { |
29 |
$vars['classes_array'][] = at_get_setting($setting); |
30 |
} |
31 |
} |
32 |
|
33 |
/**
|
34 |
* Hook into the color module.
|
35 |
*/
|
36 |
function corolla_process_html(&$vars) { |
37 |
if (module_exists('color')) { |
38 |
_color_html_alter($vars);
|
39 |
} |
40 |
} |
41 |
function corolla_process_page(&$vars) { |
42 |
if (module_exists('color')) { |
43 |
_color_page_alter($vars);
|
44 |
} |
45 |
} |
46 |
|
47 |
/**
|
48 |
* Override or insert vars into the block template.
|
49 |
*/
|
50 |
function corolla_preprocess_block(&$vars) { |
51 |
if ($vars['block']->module == 'superfish' || $vars['block']->module == 'nice_menu') { |
52 |
$vars['content_attributes_array']['class'][] = 'clearfix'; |
53 |
} |
54 |
//if ($vars['block']->region == 'menu_bar' || $vars['block']->region == 'header') {
|
55 |
//$vars['title_attributes_array']['class'][] = 'element-invisible';
|
56 |
//}
|
57 |
} |
58 |
|
59 |
/**
|
60 |
* Override or insert vars into the region template.
|
61 |
*/
|
62 |
function corolla_process_region(&$vars) { |
63 |
if ($vars['region'] === 'content') { |
64 |
$vars['outer_prefix'] = '<div class="' . $vars['classes'] . '">'; |
65 |
$vars['outer_suffix'] = '</div>'; |
66 |
} |
67 |
} |
68 |
|
69 |
/**
|
70 |
* Returns HTML for a sort icon.
|
71 |
*
|
72 |
* @param $vars
|
73 |
* An associative array containing:
|
74 |
* - style: Set to either 'asc' or 'desc', this determines which icon to show.
|
75 |
*/
|
76 |
function corolla_tablesort_indicator($vars) { |
77 |
// Use custom arrow images.
|
78 |
if ($vars['style'] == 'asc') { |
79 |
return theme('image', array('path' => path_to_theme() . '/css/images/tablesort-ascending.png', 'alt' => t('sort ascending'), 'title' => t('sort ascending'))); |
80 |
} |
81 |
else {
|
82 |
return theme('image', array('path' => path_to_theme() . '/css/images/tablesort-descending.png', 'alt' => t('sort descending'), 'title' => t('sort descending'))); |
83 |
} |
84 |
} |
85 |
|
86 |
/**
|
87 |
* Returns HTML for a fieldset form element and its children.
|
88 |
*
|
89 |
* @param $variables
|
90 |
* An associative array containing:
|
91 |
* - element: An associative array containing the properties of the element.
|
92 |
* Properties used: #attributes, #children, #collapsed, #collapsible,
|
93 |
* #description, #id, #title, #value.
|
94 |
*
|
95 |
* @ingroup themeable
|
96 |
*/
|
97 |
function corolla_fieldset($vars) { |
98 |
|
99 |
$element = $vars['element']; |
100 |
element_set_attributes($element, array('id')); |
101 |
_form_set_class($element, array('form-wrapper')); |
102 |
|
103 |
$output = '<fieldset' . drupal_attributes($element['#attributes']) . '>'; |
104 |
|
105 |
// add a class to the fieldset wrapper if a legend exists, in some instances they do not
|
106 |
$class = "without-legend"; |
107 |
|
108 |
if (!empty($element['#title'])) { |
109 |
|
110 |
// Always wrap fieldset legends in a SPAN for CSS positioning.
|
111 |
$output .= '<legend><span class="fieldset-legend">' . $element['#title'] . '</span></legend>'; |
112 |
|
113 |
// Add a class to the fieldset wrapper if a legend exists, in some instances they do not
|
114 |
$class = 'with-legend'; |
115 |
} |
116 |
|
117 |
$output .= '<div class="fieldset-wrapper ' . $class . '">'; |
118 |
|
119 |
if (!empty($element['#description'])) { |
120 |
$output .= '<div class="fieldset-description">' . $element['#description'] . '</div>'; |
121 |
} |
122 |
|
123 |
$output .= $element['#children']; |
124 |
|
125 |
if (isset($element['#value'])) { |
126 |
$output .= $element['#value']; |
127 |
} |
128 |
|
129 |
$output .= '</div>'; |
130 |
$output .= "</fieldset>\n"; |
131 |
|
132 |
return $output; |
133 |
} |