1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* General alters.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* hook_html_head_alter()
|
10
|
*/
|
11
|
function adaptivetheme_html_head_alter(&$head_elements) {
|
12
|
global $theme_key;
|
13
|
$theme_name = $theme_key;
|
14
|
|
15
|
// charset utf-8
|
16
|
$head_elements['system_meta_content_type']['#attributes'] = array('charset' => 'utf-8');
|
17
|
|
18
|
// IE Document Mode
|
19
|
if ($adaptivetheme_meta_ie_document_mode = at_get_setting('adaptivetheme_meta_ie_document_mode', $theme_name)) {
|
20
|
$head_elements['adaptivetheme_meta_ie_document_mode'] = array(
|
21
|
'#type' => 'html_tag',
|
22
|
'#tag' => 'meta',
|
23
|
'#attributes' => array(
|
24
|
'http-equiv' => "X-UA-Compatible",
|
25
|
'content' => $adaptivetheme_meta_ie_document_mode,
|
26
|
),
|
27
|
'#weight' => -999, // 1 less than the charset
|
28
|
);
|
29
|
}
|
30
|
|
31
|
// cleartype
|
32
|
if (at_get_setting('adaptivetheme_meta_clear_type', $theme_name) === 1) {
|
33
|
$head_elements['adaptivetheme_meta_clear_type'] = array(
|
34
|
'#type' => 'html_tag',
|
35
|
'#tag' => 'meta',
|
36
|
'#attributes' => array(
|
37
|
'http-equiv' => "cleartype",
|
38
|
'content' => "on",
|
39
|
),
|
40
|
'#weight' => -998,
|
41
|
);
|
42
|
}
|
43
|
|
44
|
// Don't add these if responsive styles are disabled
|
45
|
if (at_get_setting('disable_responsive_styles', $theme_name) === 0) {
|
46
|
|
47
|
// Viewport
|
48
|
if ($adaptivetheme_meta_viewport = at_get_setting('adaptivetheme_meta_viewport', $theme_name)) {
|
49
|
$head_elements['adaptivetheme_meta_viewport'] = array(
|
50
|
'#type' => 'html_tag',
|
51
|
'#tag' => 'meta',
|
52
|
'#attributes' => array(
|
53
|
'name' => 'viewport',
|
54
|
'content' => check_plain($adaptivetheme_meta_viewport),
|
55
|
),
|
56
|
'#weight' => 1,
|
57
|
);
|
58
|
}
|
59
|
|
60
|
// MobileOptimized
|
61
|
if ($adaptivetheme_meta_mobileoptimized = at_get_setting('adaptivetheme_meta_mobileoptimized', $theme_name)) {
|
62
|
$head_elements['adaptivetheme_meta_mobileoptimized'] = array(
|
63
|
'#type' => 'html_tag',
|
64
|
'#tag' => 'meta',
|
65
|
'#attributes' => array(
|
66
|
'name' => "MobileOptimized",
|
67
|
'content' => check_plain($adaptivetheme_meta_mobileoptimized),
|
68
|
),
|
69
|
'#weight' => 2,
|
70
|
);
|
71
|
}
|
72
|
|
73
|
// HandheldFriendly
|
74
|
if ($adaptivetheme_meta_handheldfriendly = at_get_setting('adaptivetheme_meta_handheldfriendly', $theme_name)) {
|
75
|
$head_elements['adaptivetheme_meta_handheldfriendly'] = array(
|
76
|
'#type' => 'html_tag',
|
77
|
'#tag' => 'meta',
|
78
|
'#attributes' => array(
|
79
|
'name' => "HandheldFriendly",
|
80
|
'content' => check_plain($adaptivetheme_meta_handheldfriendly),
|
81
|
),
|
82
|
'#weight' => 3,
|
83
|
);
|
84
|
}
|
85
|
|
86
|
// apple-mobile-web-app-capable
|
87
|
if ($adaptivetheme_meta_apple_mobile_web_app_capable = at_get_setting('adaptivetheme_meta_apple_mobile_web_app_capable', $theme_name)) {
|
88
|
$head_elements['adaptivetheme_meta_apple_mobile_web_app_capable'] = array(
|
89
|
'#type' => 'html_tag',
|
90
|
'#tag' => 'meta',
|
91
|
'#attributes' => array(
|
92
|
'name' => "apple-mobile-web-app-capable",
|
93
|
'content' => check_plain($adaptivetheme_meta_apple_mobile_web_app_capable),
|
94
|
),
|
95
|
'#weight' => 4,
|
96
|
);
|
97
|
}
|
98
|
}
|
99
|
|
100
|
// Apple touch icons - low, medium and high (see the Apple docs on touch icons)
|
101
|
if (at_get_setting('enable_apple_touch_icons') === 1) {
|
102
|
$path_to_theme = drupal_get_path('theme', $theme_name);
|
103
|
|
104
|
$rel = 'apple-touch-icon';
|
105
|
if (at_get_setting('enable_apple_touch_icon_precomposed') === 1) {
|
106
|
$rel = 'apple-touch-icon-precomposed';
|
107
|
}
|
108
|
|
109
|
// Apple default icon and Nokia shortcut icon.
|
110
|
$icon_path_default = check_plain(at_get_setting('icon_path_default', $theme_name));
|
111
|
if (!empty($icon_path_default)) {
|
112
|
$default_icon_path = $path_to_theme . '/' . $icon_path_default;
|
113
|
$default_icon_url = file_create_url($default_icon_path);
|
114
|
$head_elements['adaptivetheme_touch_icon_nokia'] = array(
|
115
|
'#type' => 'html_tag',
|
116
|
'#tag' => 'link',
|
117
|
'#weight' => -97,
|
118
|
'#attributes' => array(
|
119
|
'href' => $default_icon_url,
|
120
|
'rel' => "shortcut icon",
|
121
|
),
|
122
|
);
|
123
|
$head_elements['adaptivetheme_touch_icon_default'] = array(
|
124
|
'#type' => 'html_tag',
|
125
|
'#tag' => 'link',
|
126
|
'#weight' => -98,
|
127
|
'#attributes' => array(
|
128
|
'href' => $default_icon_url,
|
129
|
'rel' => $rel,
|
130
|
),
|
131
|
);
|
132
|
}
|
133
|
// iPad (standard display).
|
134
|
$apple_touch_icon_path_ipad = check_plain(at_get_setting('apple_touch_icon_path_ipad', $theme_name));
|
135
|
if (!empty($apple_touch_icon_path_ipad)) {
|
136
|
$ipad_icon_path = $path_to_theme . '/' . $apple_touch_icon_path_ipad;
|
137
|
$ipad_icon_url = file_create_url($ipad_icon_path);
|
138
|
$head_elements['adaptivetheme_touch_icon_ipad'] = array(
|
139
|
'#type' => 'html_tag',
|
140
|
'#tag' => 'link',
|
141
|
'#weight' => -99,
|
142
|
'#attributes' => array(
|
143
|
'href' => $ipad_icon_url,
|
144
|
'rel' => $rel,
|
145
|
'sizes' => "76x76",
|
146
|
),
|
147
|
);
|
148
|
}
|
149
|
// iPhone retina.
|
150
|
$apple_touch_icon_path_iphone_retina = check_plain(at_get_setting('apple_touch_icon_path_iphone_retina', $theme_name));
|
151
|
if (!empty($apple_touch_icon_path_iphone_retina)) {
|
152
|
$iphone_retina_icon_path = $path_to_theme . '/' . $apple_touch_icon_path_iphone_retina;
|
153
|
$iphone_retina_icon_url = file_create_url($iphone_retina_icon_path);
|
154
|
$head_elements['adaptivetheme_touch_icon_iphone_retina'] = array(
|
155
|
'#type' => 'html_tag',
|
156
|
'#tag' => 'link',
|
157
|
'#weight' => -100,
|
158
|
'#attributes' => array(
|
159
|
'href' => $iphone_retina_icon_url,
|
160
|
'rel' => $rel,
|
161
|
'sizes' => "120x120",
|
162
|
),
|
163
|
);
|
164
|
}
|
165
|
// iPad retina.
|
166
|
$apple_touch_icon_path_ipad_retina = check_plain(at_get_setting('apple_touch_icon_path_ipad_retina', $theme_name));
|
167
|
if (!empty($apple_touch_icon_path_ipad_retina)) {
|
168
|
$ipad_retina_icon_path = $path_to_theme . '/' . $apple_touch_icon_path_ipad_retina;
|
169
|
$ipad_retina_icon_url = file_create_url($ipad_retina_icon_path);
|
170
|
$head_elements['adaptivetheme_touch_icon_ipad_retina'] = array(
|
171
|
'#type' => 'html_tag',
|
172
|
'#tag' => 'link',
|
173
|
'#weight' => -100,
|
174
|
'#attributes' => array(
|
175
|
'href' => $ipad_retina_icon_url,
|
176
|
'rel' => $rel,
|
177
|
'sizes' => "152x152",
|
178
|
),
|
179
|
);
|
180
|
}
|
181
|
}
|
182
|
}
|
183
|
|
184
|
/**
|
185
|
* hook_js_alter()
|
186
|
*/
|
187
|
function adaptivetheme_js_alter(&$javascript) {
|
188
|
global $theme_key;
|
189
|
|
190
|
// Use our own vesion of vertical-tabs.js for better error handling
|
191
|
// @see http://drupal.org/node/607752
|
192
|
if (isset($javascript['misc/vertical-tabs.js'])) {
|
193
|
$file = drupal_get_path('theme', 'adaptivetheme') . '/scripts/vertical-tabs.js';
|
194
|
$javascript['misc/vertical-tabs.js'] = drupal_js_defaults($file);
|
195
|
}
|
196
|
|
197
|
// Combine JS files into one per type, this is a bit mad and
|
198
|
// we probably shouldn't encourage such things :)
|
199
|
if (at_get_setting('combine_js_files', $theme_key) === 1) {
|
200
|
uasort($javascript, 'drupal_sort_css_js');
|
201
|
$weight = 0;
|
202
|
foreach ($javascript as $name => $script) {
|
203
|
$javascript[$name]['group'] = -100;
|
204
|
$javascript[$name]['weight'] = ++$weight;
|
205
|
$javascript[$name]['every_page'] = 1;
|
206
|
}
|
207
|
}
|
208
|
}
|
209
|
|
210
|
/**
|
211
|
* hook_css_alter()
|
212
|
*/
|
213
|
function adaptivetheme_css_alter(&$css) {
|
214
|
global $theme_key;
|
215
|
|
216
|
// Never allow this to run in our admin theme and only if the extension is enabled.
|
217
|
if (at_get_setting('enable_exclude_css') === 1 && $theme_key !== 'adaptivetheme_admin') {
|
218
|
|
219
|
// Get $css_data from the cache
|
220
|
if ($cache = cache_get('at_get_css_files')) {
|
221
|
$css_data = $cache->data;
|
222
|
}
|
223
|
else {
|
224
|
$css_data = at_get_css_files($theme_key);
|
225
|
}
|
226
|
|
227
|
// We need the right theme name to get the theme settings
|
228
|
$_get_active_theme_data = array_pop($css_data);
|
229
|
if ($_get_active_theme_data['type'] == 'theme') {
|
230
|
$theme_name = $_get_active_theme_data['source'];
|
231
|
}
|
232
|
else {
|
233
|
$theme_name = $theme_key;
|
234
|
}
|
235
|
|
236
|
// Get the theme setting and unset files
|
237
|
foreach ($css_data as $key => $value) {
|
238
|
$setting = 'unset_css_' . preg_replace('/[^a-zA-Z0-9-]+/', '_', $key);
|
239
|
if (at_get_setting($setting, $theme_name) === 1) {
|
240
|
if (isset($css[$key])) {
|
241
|
unset($css[$key]);
|
242
|
}
|
243
|
}
|
244
|
}
|
245
|
|
246
|
// Unset -rtl.css files if language dir is RTL, in some contexts dir is
|
247
|
// unset, but I don't know if this is a core bug or not.
|
248
|
if (isset($language->dir) && $language->dir === 'rtl') {
|
249
|
foreach ($css_data as $key => $value) {
|
250
|
$setting = 'unset_css_' . preg_replace('/[^a-zA-Z0-9-]+/', '_', $key);
|
251
|
if (at_get_setting($setting, $theme_name) === 1) {
|
252
|
$key = str_replace('.css', '-rtl.css', $key);
|
253
|
if (isset($css[$key])) {
|
254
|
unset($css[$key]);
|
255
|
}
|
256
|
}
|
257
|
}
|
258
|
}
|
259
|
}
|
260
|
|
261
|
// Combine CSS files into one per type, this is not perfect
|
262
|
if (at_get_setting('combine_css_files', $theme_key) === 1) {
|
263
|
uasort($css, 'drupal_sort_css_js');
|
264
|
$print = array();
|
265
|
$weight = 0;
|
266
|
foreach ($css as $name => $style) {
|
267
|
// Leave the conditional stylesheets untouched
|
268
|
if (isset($css[$name]['browsers']['!IE'])) {
|
269
|
$css[$name]['group'] = 0;
|
270
|
$css[$name]['weight'] = $weight++;
|
271
|
$css[$name]['every_page'] = TRUE;
|
272
|
}
|
273
|
if ($css[$name]['media'] == 'print') {
|
274
|
$print[$name] = $css[$name];
|
275
|
unset($css[$name]);
|
276
|
}
|
277
|
}
|
278
|
$css = array_merge($css, $print);
|
279
|
}
|
280
|
}
|
281
|
|
282
|
/**
|
283
|
* hook_page_alter()
|
284
|
*/
|
285
|
function adaptivetheme_page_alter(&$page) {
|
286
|
global $theme_key;
|
287
|
$theme_name = $theme_key;
|
288
|
|
289
|
// Get the menu item
|
290
|
$menu_item = menu_get_item();
|
291
|
|
292
|
// Theme taxonomy term pages sensibly, remove redundant and potentially empty
|
293
|
// markup and wrap the node list in section elements with a class for theming.
|
294
|
if ($menu_item['tab_root'] == 'taxonomy/term/%') {
|
295
|
unset($page['content']['system_main']['term_heading']['#prefix']);
|
296
|
unset($page['content']['system_main']['term_heading']['#suffix']);
|
297
|
$page['content']['system_main']['nodes']['#prefix'] = '<section class="nodes">';
|
298
|
$page['content']['system_main']['nodes']['#suffix'] = '</section>';
|
299
|
}
|
300
|
|
301
|
if (at_get_setting('enable_extensions', $theme_name) === 1) {
|
302
|
if (at_get_setting('enable_markup_overides', $theme_name) === 1) {
|
303
|
// Remove block system main, just from the front page
|
304
|
if (drupal_is_front_page()) {
|
305
|
if (at_get_setting('unset_block_system_main_front', $theme_name) === 1) {
|
306
|
$page['content']['system_main']['#access'] = FALSE; // Brutal but effective
|
307
|
}
|
308
|
}
|
309
|
}
|
310
|
}
|
311
|
|
312
|
// Get all the regions with blocks
|
313
|
$block_regions = &drupal_static(__FUNCTION__, array());
|
314
|
|
315
|
if (empty($blocks_regions)) {
|
316
|
$block_regions = system_region_list($GLOBALS['theme'], REGIONS_VISIBLE);
|
317
|
}
|
318
|
|
319
|
// Setup the detection environment
|
320
|
$detection = variable_get('at_detection', 0);
|
321
|
if ($detection == 1) {
|
322
|
$browscap_detect = variable_get('at_browscap_detect', 0);
|
323
|
$mobile_detect = variable_get('at_mobile_detect', 0);
|
324
|
$browser = at_get_browser();
|
325
|
$page['is_mobile'] = $browser['is_mobile'];
|
326
|
$page['is_tablet'] = $browser['is_tablet'];
|
327
|
}
|
328
|
else {
|
329
|
$page['is_mobile'] = FALSE;
|
330
|
$page['is_tablet'] = FALSE;
|
331
|
}
|
332
|
|
333
|
// Look in each visible region for blocks
|
334
|
foreach ($block_regions as $region => $name) {
|
335
|
if (!empty($page[$region])) {
|
336
|
|
337
|
// Find the last block in the region
|
338
|
$blocks = array_reverse(element_children($page[$region]));
|
339
|
while ($blocks && !isset($page[$region][$blocks[0]]['#block'])) {
|
340
|
array_shift($blocks);
|
341
|
}
|
342
|
|
343
|
if ($blocks) {
|
344
|
|
345
|
// Set a bool for the last class for blocks feature
|
346
|
$page[$region][$blocks[0]]['#block']->last_in_region = TRUE;
|
347
|
|
348
|
// Alter regions and block visibility. Note that ideally this would all
|
349
|
// be better in hook_page_build(), however themes can't fire that hook.
|
350
|
if (at_get_setting('enable_extensions', $theme_name) === 1) {
|
351
|
if (at_get_setting('enable_context_regions') === 1) {
|
352
|
|
353
|
// UNSET
|
354
|
if (at_get_setting('unset_' . $region) === 1) {
|
355
|
if (at_get_setting('unset_options_' . $region) == 'unset_smalltouch') {
|
356
|
if ($page['is_mobile'] === TRUE && $page['is_tablet'] === FALSE) {
|
357
|
unset($page[$region]);
|
358
|
}
|
359
|
}
|
360
|
else {
|
361
|
// this is the all option
|
362
|
if ($page['is_mobile'] === TRUE) {
|
363
|
unset($page[$region]);
|
364
|
}
|
365
|
}
|
366
|
}
|
367
|
|
368
|
// MOVE
|
369
|
if (at_get_setting('move_region_' . $region) === 1) {
|
370
|
if (at_get_setting('move_options_' . $region) == 'move_smalltouch') {
|
371
|
if ($page['is_mobile'] === TRUE && $page['is_tablet'] === FALSE) {
|
372
|
$page = at_move_regions($page, $region, $blocks);
|
373
|
}
|
374
|
}
|
375
|
else {
|
376
|
// this is the all option
|
377
|
if ($page['is_mobile'] === TRUE) {
|
378
|
$page = at_move_regions($page, $region, $blocks);
|
379
|
}
|
380
|
}
|
381
|
}
|
382
|
}
|
383
|
}
|
384
|
}
|
385
|
}
|
386
|
}
|
387
|
|
388
|
// Run the panels test
|
389
|
if (theme_get_setting('load_all_panels') === 1) {
|
390
|
if (drupal_is_front_page()) {
|
391
|
$page['content']['#markup'] = at_debug_panels();
|
392
|
if (theme_get_setting('load_all_panels_no_sidebars') === 1) {
|
393
|
unset($page['sidebar_first']);
|
394
|
unset($page['sidebar_second']);
|
395
|
}
|
396
|
}
|
397
|
}
|
398
|
|
399
|
//kpr($page);
|
400
|
}
|
401
|
|
402
|
// Abstrat move regions processing
|
403
|
function at_move_regions($page, $region, $blocks) {
|
404
|
// Get the target region if set, check blocks can move and its not set to unset
|
405
|
if (($target_region = at_get_setting('move_' . $region)) && ($target_region !== 'do_not_move') && (at_get_setting('unset_' . $region) !== 1)) {
|
406
|
|
407
|
// Sanitize possible vector
|
408
|
$target_region = check_plain($target_region);
|
409
|
|
410
|
// Initialize the classes array
|
411
|
$classes = array();
|
412
|
|
413
|
// Move each block
|
414
|
foreach ($blocks as $block) {
|
415
|
|
416
|
// If the $target_region is empty the region markup does not print
|
417
|
// so we need to generate it manually. This is bad because it
|
418
|
// cannot account for region specific template suggestions and
|
419
|
// Adaptivethemes own region prefix and suffix wrappers.
|
420
|
if (empty($page[$target_region])) {
|
421
|
$classes[] = 'region';
|
422
|
$classes[] = 'region-' . str_replace('_', '-', $target_region);
|
423
|
if ($target_region == 'sidebar_first' || $target_region == 'sidebar_second') {
|
424
|
$classes[] = 'sidebar';
|
425
|
}
|
426
|
$classes = implode(' ', $classes);
|
427
|
$page[$target_region]['#prefix'] = '<div class="' . $classes . '"><div class="region-inner clearfix">';
|
428
|
$page[$target_region]['#suffix'] = '</div></div>';
|
429
|
}
|
430
|
|
431
|
// Move the blocks to the target region
|
432
|
$page[$target_region][$block] = $page[$region][$block];
|
433
|
|
434
|
// Unset the original block
|
435
|
unset($page[$region][$block]);
|
436
|
}
|
437
|
|
438
|
// Unset the region, all blocks are now moved
|
439
|
unset($page[$region]);
|
440
|
}
|
441
|
|
442
|
return $page;
|
443
|
}
|
444
|
|
445
|
/**
|
446
|
* hook_form_FORM_alter()
|
447
|
*/
|
448
|
function adaptivetheme_form_alter(&$form, &$form_state, $form_id) {
|
449
|
// Collapse Noggin fieldset by default
|
450
|
if ($form_id == 'system_theme_settings') {
|
451
|
if (module_exists('noggin')) {
|
452
|
$form['noggin']['#collapsible'] = TRUE;
|
453
|
$form['noggin']['#collapsed'] = TRUE;
|
454
|
}
|
455
|
}
|
456
|
}
|
457
|
|
458
|
/**
|
459
|
* hook_form_FORM_ID_alter()
|
460
|
* Modify the Advanced Search Form
|
461
|
*/
|
462
|
function adaptivetheme_form_search_form_alter(&$form, $form_state) {
|
463
|
// The problem with Drupals standard Advanced search form is that each
|
464
|
// criterion group is wrapped in a DIV, whereas it should be a fieldset with
|
465
|
// a legend, this is better semantics and improves accessibility by
|
466
|
// logically grouping field items. We make this optional via a theme setting,
|
467
|
// beacuse some people bitched that it broke some modules that require
|
468
|
// crappy markup.
|
469
|
if (at_get_setting('adv_search_extra_fieldsets') === 1) {
|
470
|
if (isset($form['module']) && $form['module']['#value'] == 'node' && user_access('use advanced search')) {
|
471
|
// Keyword boxes:
|
472
|
$form['advanced'] = array(
|
473
|
'#type' => 'fieldset',
|
474
|
'#title' => t('Advanced search'),
|
475
|
'#collapsible' => TRUE,
|
476
|
'#collapsed' => TRUE,
|
477
|
'#attributes' => array('class' => array('search-advanced')),
|
478
|
);
|
479
|
$form['advanced']['keywords-fieldset'] = array(
|
480
|
'#type' => 'fieldset',
|
481
|
'#title' => t('Keywords'),
|
482
|
'#collapsible' => FALSE,
|
483
|
);
|
484
|
$form['advanced']['keywords-fieldset']['keywords'] = array(
|
485
|
'#prefix' => '<div class="criterion">',
|
486
|
'#suffix' => '</div>',
|
487
|
);
|
488
|
$form['advanced']['keywords-fieldset']['keywords']['or'] = array(
|
489
|
'#type' => 'textfield',
|
490
|
'#title' => t('Containing any of the words'),
|
491
|
'#size' => 30,
|
492
|
'#maxlength' => 255,
|
493
|
);
|
494
|
$form['advanced']['keywords-fieldset']['keywords']['phrase'] = array(
|
495
|
'#type' => 'textfield',
|
496
|
'#title' => t('Containing the phrase'),
|
497
|
'#size' => 30,
|
498
|
'#maxlength' => 255,
|
499
|
);
|
500
|
$form['advanced']['keywords-fieldset']['keywords']['negative'] = array(
|
501
|
'#type' => 'textfield',
|
502
|
'#title' => t('Containing none of the words'),
|
503
|
'#size' => 30,
|
504
|
'#maxlength' => 255,
|
505
|
);
|
506
|
// Node types:
|
507
|
$types = array_map('check_plain', node_type_get_names());
|
508
|
$form['advanced']['types-fieldset'] = array(
|
509
|
'#type' => 'fieldset',
|
510
|
'#title' => t('Types'),
|
511
|
'#collapsible' => FALSE,
|
512
|
);
|
513
|
$form['advanced']['types-fieldset']['type'] = array(
|
514
|
'#type' => 'checkboxes',
|
515
|
'#prefix' => '<div class="criterion">',
|
516
|
'#suffix' => '</div>',
|
517
|
'#options' => $types,
|
518
|
);
|
519
|
$form['advanced']['submit'] = array(
|
520
|
'#type' => 'submit',
|
521
|
'#value' => t('Advanced search'),
|
522
|
'#prefix' => '<div class="action advanced-search-submit">',
|
523
|
'#suffix' => '</div>',
|
524
|
'#weight' => 99,
|
525
|
);
|
526
|
// Languages:
|
527
|
$language_options = array();
|
528
|
foreach (language_list('language') as $key => $entity) {
|
529
|
$language_options[$key] = $entity->name;
|
530
|
}
|
531
|
if (count($language_options) > 1) {
|
532
|
$form['advanced']['lang-fieldset'] = array(
|
533
|
'#type' => 'fieldset',
|
534
|
'#title' => t('Languages'),
|
535
|
'#collapsible' => FALSE,
|
536
|
'#collapsed' => FALSE,
|
537
|
);
|
538
|
$form['advanced']['lang-fieldset']['language'] = array(
|
539
|
'#type' => 'checkboxes',
|
540
|
'#prefix' => '<div class="criterion">',
|
541
|
'#suffix' => '</div>',
|
542
|
'#options' => $language_options,
|
543
|
);
|
544
|
}
|
545
|
$form['#validate'][] = 'node_search_validate';
|
546
|
}
|
547
|
}
|
548
|
}
|
549
|
|
550
|
/**
|
551
|
* hook_form_FORM_ID_alter()
|
552
|
* Modify the User Login Block Form
|
553
|
*/
|
554
|
function adaptivetheme_form_user_login_block_alter(&$form, &$form_state, $form_id) {
|
555
|
global $theme_key;
|
556
|
$theme_name = $theme_key;
|
557
|
if (at_get_setting('enable_extensions', $theme_name) === 1) {
|
558
|
if (at_get_setting('enable_markup_overides', $theme_name) === 1) {
|
559
|
if (at_get_setting('login_block_remove_links', $theme_name) === 1) {
|
560
|
// Remove the links
|
561
|
if (isset($form['links'])) {
|
562
|
unset($form['links']);
|
563
|
}
|
564
|
}
|
565
|
if (at_get_setting('login_block_remove_openid', $theme_name) === 1) {
|
566
|
if (module_exists('openid')) {
|
567
|
// Remove OpenID elements
|
568
|
unset($form['openid_links']);
|
569
|
unset($form['openid_identifier']);
|
570
|
unset($form['openid.return_to']);
|
571
|
}
|
572
|
}
|
573
|
if (at_get_setting('horizontal_login_block', $theme_name) === 1) {
|
574
|
// Move the links to the end of the form, so they are after the submit,
|
575
|
// OpenID really messes up the weight and I can't be bothered fighting
|
576
|
// Drupal to deal with it.
|
577
|
if (isset($form['links'])) {
|
578
|
$form['links']['#weight'] = 100;
|
579
|
}
|
580
|
}
|
581
|
}
|
582
|
}
|
583
|
}
|
584
|
|
585
|
/**
|
586
|
* hook_form_BASE_FORM_ID_alter()
|
587
|
* Modify field classes on node forms.
|
588
|
*/
|
589
|
function adaptivetheme_form_node_form_alter(&$form, &$form_state, $form_id) {
|
590
|
// Remove if #1245218 is backported to D7 core.
|
591
|
foreach (array_keys($form) as $item) {
|
592
|
if (strpos($item, 'field_') === 0) {
|
593
|
if (!empty($form[$item]['#attributes']['class'])) {
|
594
|
foreach ($form[$item]['#attributes']['class'] as &$class) {
|
595
|
if (strpos($class, 'field-type-') === 0 || strpos($class, 'field-name-') === 0) {
|
596
|
// Make the class different from that used in theme_field().
|
597
|
$class = $class . '-form';
|
598
|
}
|
599
|
}
|
600
|
}
|
601
|
}
|
602
|
}
|
603
|
}
|
604
|
|
605
|
/**
|
606
|
* Set a class on the iframe body element for WYSIWYG editors. This allows you
|
607
|
* to easily override the background for the iframe body element.
|
608
|
* This only works for the WYSIWYG module: http://drupal.org/project/wysiwyg
|
609
|
*/
|
610
|
function adaptivetheme_wysiwyg_editor_settings_alter(&$settings, &$context) {
|
611
|
$settings['bodyClass'] = 'wysiwygeditor';
|
612
|
}
|
613
|
|
614
|
/**
|
615
|
* Output for the debug panels test. This is pretty sucky because its
|
616
|
* hard coded and therefor does not include any custom Panels layout
|
617
|
* plugins you might include in a subtheme, bad eh?
|
618
|
*/
|
619
|
function at_debug_panels() {
|
620
|
$output = <<<EOF
|
621
|
<div class="all-panel-layouts debug-panels">
|
622
|
|
623
|
<h1>Panels/Gpanels Layout Test</h1>
|
624
|
<p>To disable this test uncheck the theme setting <em>Debuggers > Load all panels in the front page content region</em></p>
|
625
|
|
626
|
<div class="at-panel panel-display one-column clearfix">
|
627
|
<div class="region region-one-main">
|
628
|
<div class="region-inner clearfix">
|
629
|
</div>
|
630
|
</div>
|
631
|
</div>
|
632
|
|
633
|
<div class="at-panel panel-display two-50 clearfix">
|
634
|
<div class="region region-two-50-top region-conditional-stack">
|
635
|
<div class="region-inner clearfix">
|
636
|
</div>
|
637
|
</div>
|
638
|
<div class="region region-two-50-first">
|
639
|
<div class="region-inner clearfix">
|
640
|
</div>
|
641
|
</div>
|
642
|
<div class="region region-two-50-second">
|
643
|
<div class="region-inner clearfix">
|
644
|
</div>
|
645
|
</div>
|
646
|
<div class="region region-two-50-bottom region-conditional-stack">
|
647
|
<div class="region-inner clearfix">
|
648
|
</div>
|
649
|
</div>
|
650
|
</div>
|
651
|
|
652
|
<div class="at-panel panel-display two-33-66 clearfix">
|
653
|
<div class="region region-two-33-66-top region-conditional-stack">
|
654
|
<div class="region-inner clearfix">
|
655
|
</div>
|
656
|
</div>
|
657
|
<div class="region region-two-33-66-first">
|
658
|
<div class="region-inner clearfix">
|
659
|
</div>
|
660
|
</div>
|
661
|
<div class="region region-two-33-66-second">
|
662
|
<div class="region-inner clearfix">
|
663
|
</div>
|
664
|
</div>
|
665
|
<div class="region region-two-33-66-bottom region-conditional-stack">
|
666
|
<div class="region-inner clearfix">
|
667
|
</div>
|
668
|
</div>
|
669
|
</div>
|
670
|
|
671
|
<div class="at-panel panel-display two-66-33 clearfix">
|
672
|
<div class="region region-two-66-33-top region-conditional-stack">
|
673
|
<div class="region-inner clearfix">
|
674
|
</div>
|
675
|
</div>
|
676
|
<div class="region region-two-66-33-first">
|
677
|
<div class="region-inner clearfix">
|
678
|
</div>
|
679
|
</div>
|
680
|
<div class="region region-two-66-33-second">
|
681
|
<div class="region-inner clearfix">
|
682
|
</div>
|
683
|
</div>
|
684
|
<div class="region region-two-66-33-bottom region-conditional-stack">
|
685
|
<div class="region-inner clearfix">
|
686
|
</div>
|
687
|
</div>
|
688
|
</div>
|
689
|
|
690
|
<div class="at-panel panel-display two-brick clearfix">
|
691
|
<div class="region region-two-brick-top region-conditional-stack">
|
692
|
<div class="region-inner clearfix">
|
693
|
</div>
|
694
|
</div>
|
695
|
<div class="panel-row row-1 clearfix">
|
696
|
<div class="region region-two-brick-left-above">
|
697
|
<div class="region-inner clearfix">
|
698
|
</div>
|
699
|
</div>
|
700
|
<div class="region region-two-brick-right-above">
|
701
|
<div class="region-inner clearfix">
|
702
|
</div>
|
703
|
</div>
|
704
|
</div>
|
705
|
<div class="region region-two-brick-middle region-conditional-stack">
|
706
|
<div class="region-inner clearfix">
|
707
|
</div>
|
708
|
</div>
|
709
|
<div class="panel-row row-2 clearfix">
|
710
|
<div class="region region-two-brick-left-below">
|
711
|
<div class="region-inner clearfix">
|
712
|
</div>
|
713
|
</div>
|
714
|
<div class="region region-two-brick-right-below">
|
715
|
<div class="region-inner clearfix">
|
716
|
</div>
|
717
|
</div>
|
718
|
</div>
|
719
|
<div class="region region-two-brick-bottom region-conditional-stack">
|
720
|
<div class="region-inner clearfix">
|
721
|
</div>
|
722
|
</div>
|
723
|
</div>
|
724
|
|
725
|
<div class="at-panel panel-display three-3x33 clearfix">
|
726
|
<div class="region region-three-33-top region-conditional-stack">
|
727
|
<div class="region-inner clearfix">
|
728
|
</div>
|
729
|
</div>
|
730
|
<div class="region region-three-33-first">
|
731
|
<div class="region-inner clearfix">
|
732
|
</div>
|
733
|
</div>
|
734
|
<div class="region region-three-33-second">
|
735
|
<div class="region-inner clearfix">
|
736
|
</div>
|
737
|
</div>
|
738
|
<div class="region region-three-33-third">
|
739
|
<div class="region-inner clearfix">
|
740
|
</div>
|
741
|
</div>
|
742
|
<div class="region region-three-33-bottom region-conditional-stack">
|
743
|
<div class="region-inner clearfix">
|
744
|
</div>
|
745
|
</div>
|
746
|
</div>
|
747
|
|
748
|
<div class="at-panel panel-display three-25-50-25 clearfix">
|
749
|
<div class="region region-three-25-50-25-top region-conditional-stack">
|
750
|
<div class="region-inner clearfix">
|
751
|
</div>
|
752
|
</div>
|
753
|
<div class="region region-three-25-50-25-first">
|
754
|
<div class="region-inner clearfix">
|
755
|
</div>
|
756
|
</div>
|
757
|
<div class="region region-three-25-50-25-second">
|
758
|
<div class="region-inner clearfix">
|
759
|
</div>
|
760
|
</div>
|
761
|
<div class="region region-three-25-50-25-third">
|
762
|
<div class="region-inner clearfix">
|
763
|
</div>
|
764
|
</div>
|
765
|
<div class="region region-three-25-50-25-bottom region-conditional-stack">
|
766
|
<div class="region-inner clearfix">
|
767
|
</div>
|
768
|
</div>
|
769
|
</div>
|
770
|
|
771
|
<div class="at-panel panel-display three-25-25-50 clearfix">
|
772
|
<div class="region region-three-25-25-50-top region-conditional-stack">
|
773
|
<div class="region-inner clearfix">
|
774
|
</div>
|
775
|
</div>
|
776
|
<div class="region region-three-25-25-50-first">
|
777
|
<div class="region-inner clearfix">
|
778
|
</div>
|
779
|
</div>
|
780
|
<div class="region region-three-25-25-50-second">
|
781
|
<div class="region-inner clearfix">
|
782
|
</div>
|
783
|
</div>
|
784
|
<div class="region region-three-25-25-50-third">
|
785
|
<div class="region-inner clearfix">
|
786
|
</div>
|
787
|
</div>
|
788
|
<div class="region region-three-25-25-50-bottom region-conditional-stack">
|
789
|
<div class="region-inner clearfix">
|
790
|
</div>
|
791
|
</div>
|
792
|
</div>
|
793
|
|
794
|
<div class="at-panel panel-display three-50-25-25 clearfix">
|
795
|
<div class="region region-three-50-25-25-top region-conditional-stack">
|
796
|
<div class="region-inner clearfix">
|
797
|
</div>
|
798
|
</div>
|
799
|
<div class="region region-three-50-25-25-first">
|
800
|
<div class="region-inner clearfix">
|
801
|
</div>
|
802
|
</div>
|
803
|
<div class="region region-three-50-25-25-second">
|
804
|
<div class="region-inner clearfix">
|
805
|
</div>
|
806
|
</div>
|
807
|
<div class="region region-three-50-25-25-third">
|
808
|
<div class="region-inner clearfix">
|
809
|
</div>
|
810
|
</div>
|
811
|
<div class="region region-three-50-25-25-bottom region-conditional-stack">
|
812
|
<div class="region-inner clearfix">
|
813
|
</div>
|
814
|
</div>
|
815
|
</div>
|
816
|
|
817
|
<div class="at-panel panel-display four-4x25 clearfix">
|
818
|
<div class="panel-row row-1 clearfix">
|
819
|
<div class="region region-four-first">
|
820
|
<div class="region-inner clearfix">
|
821
|
</div>
|
822
|
</div>
|
823
|
<div class="region region-four-second">
|
824
|
<div class="region-inner clearfix">
|
825
|
</div>
|
826
|
</div>
|
827
|
</div>
|
828
|
<div class="panel-row row-2 clearfix">
|
829
|
<div class="region region-four-third">
|
830
|
<div class="region-inner clearfix">
|
831
|
</div>
|
832
|
</div>
|
833
|
<div class="region region-four-fourth">
|
834
|
<div class="region-inner clearfix">
|
835
|
</div>
|
836
|
</div>
|
837
|
</div>
|
838
|
</div>
|
839
|
|
840
|
<div class="at-panel panel-display five-5x20 clearfix">
|
841
|
<div class="panel-row row-1 clearfix">
|
842
|
<div class="region region-five-first">
|
843
|
<div class="region-inner clearfix">
|
844
|
</div>
|
845
|
</div>
|
846
|
<div class="region region-five-second">
|
847
|
<div class="region-inner clearfix">
|
848
|
</div>
|
849
|
</div>
|
850
|
</div>
|
851
|
<div class="panel-row row-2 clearfix">
|
852
|
<div class="region region-five-third">
|
853
|
<div class="region-inner clearfix">
|
854
|
</div>
|
855
|
</div>
|
856
|
<div class="region region-five-fourth">
|
857
|
<div class="region-inner clearfix">
|
858
|
</div>
|
859
|
</div>
|
860
|
<div class="region region-five-fifth">
|
861
|
<div class="region-inner clearfix">
|
862
|
</div>
|
863
|
</div>
|
864
|
</div>
|
865
|
</div>
|
866
|
|
867
|
<div class="at-panel panel-display six-6x16 multicolumn clearfix">
|
868
|
<div class="panel-row row-1 clearfix">
|
869
|
<div class="region region-six-first">
|
870
|
<div class="region-inner clearfix">
|
871
|
</div>
|
872
|
</div>
|
873
|
<div class="region region-six-second">
|
874
|
<div class="region-inner clearfix">
|
875
|
</div>
|
876
|
</div>
|
877
|
</div>
|
878
|
<div class="panel-row row-2 clearfix">
|
879
|
<div class="region region-six-third">
|
880
|
<div class="region-inner clearfix">
|
881
|
</div>
|
882
|
</div>
|
883
|
<div class="region region-six-fourth">
|
884
|
<div class="region-inner clearfix">
|
885
|
</div>
|
886
|
</div>
|
887
|
</div>
|
888
|
<div class="panel-row row-3 clearfix">
|
889
|
<div class="region region-six-fifth">
|
890
|
<div class="region-inner clearfix">
|
891
|
</div>
|
892
|
</div>
|
893
|
<div class="region region-six-sixth">
|
894
|
<div class="region-inner clearfix">
|
895
|
</div>
|
896
|
</div>
|
897
|
</div>
|
898
|
</div>
|
899
|
|
900
|
<div class="at-panel panel-panel three-inset-left clearfix">
|
901
|
<div class="region region-three-inset-left-sidebar">
|
902
|
<div class="region-inner clearfix">
|
903
|
</div>
|
904
|
</div>
|
905
|
<div class="inset-wrapper clearfix">
|
906
|
<div class="region region-three-inset-left-top region-conditional-stack">
|
907
|
<div class="region-inner clearfix">
|
908
|
</div>
|
909
|
</div>
|
910
|
<div class="region region-three-inset-left-middle">
|
911
|
<div class="region-inner clearfix">
|
912
|
</div>
|
913
|
</div>
|
914
|
<div class="region region-three-inset-left-inset">
|
915
|
<div class="region-inner clearfix">
|
916
|
</div>
|
917
|
</div>
|
918
|
<div class="region region-three-inset-left-bottom region-conditional-stack">
|
919
|
<div class="region-inner clearfix">
|
920
|
</div>
|
921
|
</div>
|
922
|
</div>
|
923
|
</div>
|
924
|
|
925
|
<div class="at-panel panel-panel three-inset-right clearfix">
|
926
|
<div class="region region-three-inset-right-sidebar">
|
927
|
<div class="region-inner clearfix">
|
928
|
</div>
|
929
|
</div>
|
930
|
<div class="inset-wrapper clearfix">
|
931
|
<div class="region region-three-inset-right-top region-conditional-stack">
|
932
|
<div class="region-inner clearfix">
|
933
|
</div>
|
934
|
</div>
|
935
|
<div class="region region-three-inset-right-middle">
|
936
|
<div class="region-inner clearfix">
|
937
|
</div>
|
938
|
</div>
|
939
|
<div class="region region-three-inset-right-inset">
|
940
|
<div class="region-inner clearfix">
|
941
|
</div>
|
942
|
</div>
|
943
|
<div class="region region-three-inset-right-bottom region-conditional-stack">
|
944
|
<div class="region-inner clearfix">
|
945
|
</div>
|
946
|
</div>
|
947
|
</div>
|
948
|
</div>
|
949
|
</div>
|
950
|
EOF;
|
951
|
|
952
|
return $output;
|
953
|
}
|