-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.php
More file actions
239 lines (213 loc) · 7.33 KB
/
template.php
File metadata and controls
239 lines (213 loc) · 7.33 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
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
<?php
/**
* Implements template_preprocess_html().
*
*/
//function STARTER_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 STARTER_preprocess_page(&$variables) {
//}
/**
* Implements template_preprocess_node
*
*/
function campo_intra_preprocess_node(&$variables) {
}
/**
* Implements hook_preprocess_block()
*/
//function STARTER_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 STARTER_preprocess_views_view(&$variables) {
//}
/**
* Implements template_preprocess_panels_pane().
*
*/
//function STARTER_preprocess_panels_pane(&$variables) {
//}
/**
* Implements template_preprocess_views_views_fields().
*
*/
//function STARTER_preprocess_views_view_fields(&$variables) {
//}
/**
* Implements theme_form_element_label()
* Use foundation tooltips
*/
//function STARTER_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 STARTER_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 STARTER_form_alter(&$form, &$form_state, $form_id) {
// // Sexy submit buttons
// if (!empty($form['actions']) && !empty($form['actions']['submit'])) {
// $form['actions']['submit']['#attributes'] = array('class' => array('primary', 'button', 'radius'));
// }
//}
function campo_intra_form_comment_form_alter(&$form, &$form_state) {
// dpm($form);
unset($form['subject']);
$form['actions']['submit']['#attributes']['class'][4] = ('small');
$form['actions']['submit']['#attributes']['class'][5] = ('expand');
$form['tilmeld']['submit']['#attributes']['class'][] = ('small');
}
/**
* Implements hook_preprocess_user_picture.
* Delete the 'image' in picture alt.
*/
function campo_intra_preprocess_user_picture(&$variables) {
$variables['user_picture'] = '';
if (variable_get('user_pictures', 0)) {
$account = $variables['account'];
if (!empty($account->picture)) {
if (is_numeric($account->picture)) {
$account->picture = file_load($account->picture);
}
if (!empty($account->picture->uri)) {
$filepath = $account->picture->uri;
}
}
elseif (variable_get('user_picture_default', '')) {
$filepath = variable_get('user_picture_default', '');
}
if (isset($filepath)) {
$alt = t("@user", array('@user' => format_username($account)));
// If the image does not have a valid Drupal scheme (for eg. HTTP),
// don't load image styles.
if (module_exists('image') && file_valid_uri($filepath) && $style = variable_get('user_picture_style', '')) {
$variables['user_picture'] = theme('image_style', array('style_name' => $style, 'path' => $filepath, 'alt' => $alt, 'title' => $alt));
}
else {
$variables['user_picture'] = theme('image', array('path' => $filepath, 'alt' => $alt, 'title' => $alt));
}
if (!empty($account->uid) && user_access('access user profiles')) {
$attributes = array(
'attributes' => array('title' => t('View user profile.')),
'html' => TRUE,
);
$variables['user_picture'] = l($variables['user_picture'], "user/$account->uid", $attributes);
}
}
}
}
// Sexy preview buttons
//function STARTER_form_comment_form_alter(&$form, &$form_state) {
// $form['actions']['preview']['#attributes']['class'][] = array('class' => array('secondary', 'button', 'radius'));
//}
/**
* 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 STARTER_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 STARTER_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]);
}
}
}