-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.php
More file actions
179 lines (160 loc) · 5.34 KB
/
template.php
File metadata and controls
179 lines (160 loc) · 5.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
// Pixture Reloaded by Adaptivethemes.com
/**
* Override or insert variables into the html template.
*/
function pixture_reloaded_preprocess_html(&$vars) {
global $theme_key;
$theme_name = 'pixture_reloaded';
$path_to_theme = drupal_get_path('theme', $theme_name);
// Load the media queries styles
$media_queries_css = array(
$theme_name . '.responsive.style.css',
$theme_name . '.responsive.gpanels.css'
);
load_subtheme_media_queries($media_queries_css, $theme_name);
// Add a class for the active color scheme
if (module_exists('color')) {
$class = check_plain(get_color_scheme_name($theme_key));
$vars['classes_array'][] = 'color-scheme-' . drupal_html_class($class);
}
// Add class for the active theme
$vars['classes_array'][] = drupal_html_class($theme_key);
// Add theme settings classes
$settings_array = array(
'font_size',
'box_shadows',
'body_background',
'menu_bullets',
'menu_bar_position',
'corner_radius',
'image_alignment',
);
foreach ($settings_array as $setting) {
$vars['classes_array'][] = theme_get_setting($setting);
}
// Fonts
$fonts = array(
'bf' => 'base_font',
'snf' => 'site_name_font',
'ssf' => 'site_slogan_font',
'ptf' => 'page_title_font',
'ntf' => 'node_title_font',
'ctf' => 'comment_title_font',
'btf' => 'block_title_font'
);
$families = get_font_families($fonts, $theme_key);
if (!empty($families)) {
foreach ($families as $family) {
$vars['classes_array'][] = $family;
}
}
// Add Noggin module settings extra classes, not all designs can support header images
if (module_exists('noggin')) {
if (variable_get('noggin:use_header', FALSE)) {
$va = theme_get_setting('noggin_image_vertical_alignment');
$ha = theme_get_setting('noggin_image_horizontal_alignment');
$vars['classes_array'][] = 'ni-a-' . $va . $ha;
$vars['classes_array'][] = theme_get_setting('noggin_image_repeat');
$vars['classes_array'][] = theme_get_setting('noggin_image_width');
}
}
// Special case for PIE htc rounded corners, not all themes include this
if (theme_get_setting('ie_corners') == 1) {
drupal_add_css($path_to_theme . '/css/ie-htc.css', array(
'group' => CSS_THEME,
'browsers' => array(
'IE' => 'lte IE 8',
'!IE' => FALSE,
),
'preprocess' => FALSE,
)
);
}
// Headings styles
if (theme_get_setting('headings_styles_caps') == 1) {
$vars['classes_array'][] = 'hs-caps';
}
if (theme_get_setting('headings_styles_weight') == 1) {
$vars['classes_array'][] = 'hs-fwn';
}
if (theme_get_setting('headings_styles_shadow') == 1) {
$vars['classes_array'][] = 'hs-ts';
}
}
/**
* Override or insert variables into the html template.
*/
function pixture_reloaded_process_html(&$vars) {
// Hook into color.module
if (module_exists('color')) {
_color_html_alter($vars);
}
}
/**
* Override or insert variables into the page template.
*/
function pixture_reloaded_process_page(&$vars) {
// Hook into color.module
if (module_exists('color')) {
_color_page_alter($vars);
}
}
/**
* Override or insert variables into the block template.
*/
function pixture_reloaded_preprocess_block(&$vars) {
if($vars['block']->module == 'superfish' || $vars['block']->module == 'nice_menu') {
$vars['content_attributes_array']['class'][] = 'clearfix';
}
}
/**
* Override or insert variables into the field template.
*/
function pixture_reloaded_preprocess_field(&$vars) {
$element = $vars['element'];
$vars['classes_array'][] = 'view-mode-' . $element['#view_mode'];
$vars['image_caption_teaser'] = FALSE;
$vars['image_caption_full'] = FALSE;
if (theme_get_setting('image_caption_teaser') == 1) {
$vars['image_caption_teaser'] = TRUE;
}
if (theme_get_setting('image_caption_full') == 1) {
$vars['image_caption_full'] = TRUE;
}
$vars['field_view_mode'] = '';
$vars['field_view_mode'] = $element['#view_mode'];
}
/**
* Implements hook_preprocess_search_results().
*/
function pixture_reloaded_preprocess_search_results(&$vars) {
// search.module shows 10 items per page (this isn't customizable)
$itemsPerPage = 10;
// Determine which page is being viewed
// If $_REQUEST['page'] is not set, we are on page 1
$currentPage = (isset($_REQUEST['page']) ? $_REQUEST['page'] : 0) + 1;
// Get the total number of results from the global pager
$total = $GLOBALS['pager_total_items'][0];
// Determine which results are being shown ("Showing results x through y")
$start = (10 * $currentPage) - 9;
// If on the last page, only go up to $total, not the total that COULD be
// shown on the page. This prevents things like "Displaying 11-20 of 17".
$end = (($itemsPerPage * $currentPage) >= $total) ? $total : ($itemsPerPage * $currentPage);
// If there is more than one page of results:
if ($total > $itemsPerPage) {
$vars['search_totals'] = t('Displaying !start - !end of !total results', array(
'!start' => $start,
'!end' => $end,
'!total' => $total,
));
}
else {
// Only one page of results, so make it simpler
$vars['search_totals'] = t('Displaying !total !results_label', array(
'!total' => $total,
// Be smart about labels: show "result" for one, "results" for multiple
'!results_label' => format_plural($total, 'result', 'results'),
));
}
}