-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplate.php
101 lines (89 loc) · 2.84 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
<?php
/**
* @file
* Template preprocess functions
*/
/**
* Implements hook_css_alter().
*/
function gotham_css_alter(&$css) {
$exclude = array(
'modules/system/system.css' => FALSE,
'modules/system/system.admin.css' => FALSE,
// 'modules/system/system.base.css' => FALSE, // this one adds the autocomplete styles
'modules/system/system.maintenance.css' => FALSE,
'modules/system/system.menus.css' => FALSE,
'modules/system/system.messages.css' => FALSE,
'modules/system/system.theme.css' => FALSE,
'modules/node/node.css' => FALSE,
'modules/search/search.css' => FALSE,
'modules/user/user.css' => FALSE,
// Un-comment as needed
// 'sites/all/modules/contrib/ckeditor/css/ckeditor.css' => FALSE,
// 'sites/all/modules/contrib/entity_embed/css/entity_embed.css' => FALSE,
// 'sites/all/modules/contrib/views/css/views.css' => FALSE,
// 'sites/all/modules/contrib/date/date_api/date.css' => FALSE,
// 'sites/all/modules/contrib/date/date_popup/themes/datepicker.1.7.css' => FALSE,
);
$css = array_diff_key($css, $exclude);
}
/**
* Implements hook_preprocess_html().
*/
function gotham_preprocess_html(&$vars) {
$viewport = array(
'#tag' => 'meta',
'#attributes' => array(
'name' => 'viewport',
'content' => 'width=device-width, initial-scale=1',
),
);
$ie_ua = array(
'#tag' => 'meta',
'#attributes' => array(
'http-equiv' => 'X-UA-Compatible',
'content' => 'IE=edge,chrome=1',
),
);
drupal_add_html_head($viewport, 'viewport');
drupal_add_html_head($ie_ua, 'x-ua-compatible');
}
/**
* Implements hook_preprocess_page().
*/
function gotham_preprocess_page(&$vars) {
// unset the 'page' class for the site-wrapper
unset($vars['classes_array'][0]);
$vars['classes_array'][] = 'site';
// make page--node--NODETYPE.tpl.php available
if(!empty($vars['node'])) {
$vars['theme_hook_suggestions'][] = 'page__node__'.$vars['node']->type;
}
// create copywrite variable
$vars['copywrite'] = t('All rights reserved. © !date', array('date' => date('Y')));
}
/**
* Implements hook_preprocess_node().
*/
function gotham_preprocess_node(&$vars) {
// Add default title wrapper
$vars['title_wrapper'] = 'h2';
// Add css class "node-NODETYPE--VIEWMODE" to nodes
$vars['classes_array'][] = 'node-' . $vars['type'] . '--' . drupal_html_class($vars['view_mode']);
}
/**
* Implements hook_preprocess_block().
*/
function gotham_preprocess_block(&$vars) {
// Set default title wrapper
$vars['title_wrapper'] = 'h3';
// Set default block title class
$vars['title_attributes_array']['class'][] = 'block__title';
// apply the block bare tpl to certain blocks
$bare_blocks = array(
'block-system-main',
);
if(in_array($vars['block_html_id'], $bare_blocks)) {
$vars['theme_hook_suggestions'][] = 'block__bare';
}
}