-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.php
248 lines (221 loc) · 7.41 KB
/
template.php
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<?php
/**
* Implements template_preprocess_html().
*
*/
//function poleon_preprocess_html(&$variables) {
// // Add conditional CSS for IE. To use uncomment below and add IE css file
// drupal_add_css(path_to_theme() . '/css/ie.css', array('weight' => CSS_THEME, 'browsers' => array('!IE' => FALSE), 'preprocess' => FALSE));
//
// // Need legacy support for IE downgrade to Foundation 2 or use JS file below
// // drupal_add_js('http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE7.js', 'external');
//}
/**
* Implements template_preprocess_page
*
*/
function poleon_preprocess_page(&$variables) {
// from http://drupal.stackexchange.com/a/78638/10939
if (module_exists('page_manager') && sizeof(page_manager_get_current_page())) {
$variables['theme_hook_suggestions'][] = 'page__panels';
}
// Menus for alternative header.
$variables['alt_main_menu'] = '';
if (!empty($variables['main_menu'])) {
$variables['alt_main_menu'] = theme('links__system_main_menu', array(
'links' => $variables['main_menu'],
'attributes' => array(
'id' => 'main-menu-links',
'class' => array('links', 'inline-list', 'clearfix', 'menu'),
),
'heading' => array(
'text' => t('Main menu'),
'level' => 'h2',
'class' => array('element-invisible'),
),
));
}
// Alter alt secondary menu if necessary
$variables['alt_secondary_menu'] = '';
if (!empty($variables['secondary_menu'])) {
$variables['alt_secondary_menu'] = theme('links__system_secondary_menu', array(
'links' => $variables['secondary_menu'],
'attributes' => array(
'id' => 'secondary-menu-links',
'class' => array('links', 'inline-list', 'clearfix', 'menu'),
),
'heading' => array(
'text' => t('Secondary menu'),
'level' => 'h2',
'class' => array('element-invisible'),
),
));
}
}
/**
* Implements template_preprocess_node
*
*/
//function poleon_preprocess_node(&$variables) {
//}
/**
* Implements hook_preprocess_block()
*/
//function poleon_preprocess_block(&$variables) {
// // Add wrapping div with global class to all block content sections.
// $variables['content_attributes_array']['class'][] = 'block-content';
//
// // Convenience variable for classes based on block ID
// $block_id = $variables['block']->module . '-' . $variables['block']->delta;
//
// // Add classes based on a specific block
// switch ($block_id) {
// // System Navigation block
// case 'system-navigation':
// // Custom class for entire block
// $variables['classes_array'][] = 'system-nav';
// // Custom class for block title
// $variables['title_attributes_array']['class'][] = 'system-nav-title';
// // Wrapping div with custom class for block content
// $variables['content_attributes_array']['class'] = 'system-nav-content';
// break;
//
// // User Login block
// case 'user-login':
// // Hide title
// $variables['title_attributes_array']['class'][] = 'element-invisible';
// break;
//
// // Example of adding Foundation classes
// case 'block-foo': // Target the block ID
// // Set grid column or mobile classes or anything else you want.
// $variables['classes_array'][] = 'six columns';
// break;
// }
//
// // Add template suggestions for blocks from specific modules.
// switch($variables['elements']['#block']->module) {
// case 'menu':
// $variables['theme_hook_suggestions'][] = 'block__nav';
// break;
// }
//}
//function poleon_preprocess_views_view(&$variables) {
//}
/**
* Implements template_preprocess_panels_pane().
*
*/
//function poleon_preprocess_panels_pane(&$variables) {
//}
/**
* Implements template_preprocess_views_views_fields().
*
*/
//function poleon_preprocess_views_view_fields(&$variables) {
//}
/**
* Implements theme_form_element_label()
* Use foundation tooltips
*/
//function poleon_form_element_label($variables) {
// if (!empty($variables['element']['#title'])) {
// $variables['element']['#title'] = '<span class="secondary label">' . $variables['element']['#title'] . '</span>';
// }
// if (!empty($variables['element']['#description'])) {
// $variables['element']['#description'] = ' <span data-tooltip="top" class="has-tip tip-top" data-width="250" title="' . $variables['element']['#description'] . '">' . t('More information?') . '</span>';
// }
// return theme_form_element_label($variables);
//}
/**
* Implements hook_preprocess_button().
*/
//function poleon_preprocess_button(&$variables) {
// $variables['element']['#attributes']['class'][] = 'button';
// if (isset($variables['element']['#parents'][0]) && $variables['element']['#parents'][0] == 'submit') {
// $variables['element']['#attributes']['class'][] = 'secondary';
// }
//}
/**
* Implements hook_form_alter()
* Example of using foundation sexy buttons
*/
//function poleon_form_alter(&$form, &$form_state, $form_id) {
// // Sexy submit buttons
// if (!empty($form['actions']) && !empty($form['actions']['submit'])) {
// $classes = (is_array($form['actions']['submit']['#attributes']['class']))
// ? $form['actions']['submit']['#attributes']['class']
// : array();
// $classes = array_merge($classes, array('secondary', 'button', 'radius'));
// $form['actions']['submit']['#attributes']['class'] = $classes;
// }
//}
/**
* Implements hook_form_FORM_ID_alter()
* Example of using foundation sexy buttons on comment form
*/
//function poleon_form_comment_form_alter(&$form, &$form_state) {
// Sexy preview buttons
// $classes = (is_array($form['actions']['preview']['#attributes']['class']))
// ? $form['actions']['preview']['#attributes']['class']
// : array();
// $classes = array_merge($classes, array('secondary', 'button', 'radius'));
// $form['actions']['preview']['#attributes']['class'] = $classes;
//}
/**
* Implements template_preprocess_panels_pane().
*/
// function zurb_foundation_preprocess_panels_pane(&$variables) {
// }
/**
* Implements template_preprocess_views_views_fields().
*/
/* Delete me to enable
function THEMENAME_preprocess_views_view_fields(&$variables) {
if ($variables['view']->name == 'nodequeue_1') {
// Check if we have both an image and a summary
if (isset($variables['fields']['field_image'])) {
// If a combined field has been created, unset it and just show image
if (isset($variables['fields']['nothing'])) {
unset($variables['fields']['nothing']);
}
} elseif (isset($variables['fields']['title'])) {
unset ($variables['fields']['title']);
}
// Always unset the separate summary if set
if (isset($variables['fields']['field_summary'])) {
unset($variables['fields']['field_summary']);
}
}
}
// */
/**
* Implements hook_css_alter().
*/
function poleon_css_alter(&$css) {
// Always remove base theme CSS.
$theme_path = drupal_get_path('theme', 'zurb_foundation');
foreach($css as $path => $values) {
if(strpos($path, $theme_path) === 0) {
unset($css[$path]);
}
}
}
/**
* Implements hook_js_alter().
*/
function poleon_js_alter(&$js) {
// Always remove base theme JS.
$theme_path = drupal_get_path('theme', 'zurb_foundation');
foreach($js as $path => $values) {
if(strpos($path, $theme_path) === 0) {
unset($js[$path]);
}
}
}
/**
* Modify custom footer menu attributes
*/
function poleon_menu_tree__menu_footer_menu($variables) {
return '<ul class="menu inline-list right tight-bottom">' . $variables['tree'] . '</ul>';
}