-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtemplate.php
180 lines (167 loc) · 5.14 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
<?php
/**
* @file
* Provides overrides and additions to aid the theme.
*/
/**
* Implements hook_form_FORM_ID_alter().
*
* Adds a placeholder to the search block.
*/
function wundertheme_form_search_block_form_alter(&$form, &$form_state, $form_id) {
$form['search_block_form']['#attributes']['placeholder'] = t('Search…');
}
/**
* Implements hook_css_alter().
*/
function wundertheme_css_alter(&$css) {
/* Remove some default Drupal css */
$exclude = array(
'modules/aggregator/aggregator.css' => FALSE,
'modules/block/block.css' => FALSE,
'modules/book/book.css' => FALSE,
'modules/comment/comment.css' => FALSE,
'modules/dblog/dblog.css' => FALSE,
'modules/field/theme/field.css' => FALSE,
'modules/file/file.css' => FALSE,
'modules/filter/filter.css' => FALSE,
'modules/forum/forum.css' => FALSE,
'modules/help/help.css' => FALSE,
'modules/menu/menu.css' => FALSE,
'modules/node/node.css' => FALSE,
'modules/openid/openid.css' => FALSE,
'modules/poll/poll.css' => FALSE,
'modules/profile/profile.css' => FALSE,
'modules/search/search.css' => FALSE,
'modules/statistics/statistics.css' => FALSE,
'modules/syslog/syslog.css' => FALSE,
'modules/system/admin.css' => FALSE,
'modules/system/maintenance.css' => FALSE,
'modules/system/system.css' => FALSE,
'modules/system/system.admin.css' => FALSE,
'modules/system/system.maintenance.css' => FALSE,
'modules/system/system.messages.css' => FALSE,
'modules/system/system.theme.css' => FALSE,
'modules/system/system.menus.css' => FALSE,
'modules/taxonomy/taxonomy.css' => FALSE,
'modules/tracker/tracker.css' => FALSE,
'modules/update/update.css' => FALSE,
'modules/user/user.css' => FALSE,
);
$css = array_diff_key($css, $exclude);
/* Get rid of some default panel css */
foreach ($css as $path => $meta) {
if (strpos($path, 'threecol_33_34_33_stacked') !== FALSE || strpos($path, 'threecol_25_50_25_stacked') !== FALSE) {
unset($css[$path]);
}
}
}
/**
* Override or insert variables into the html template.
*
* @param $variables
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered. This is usually "html", but can
* also be "maintenance_page" since zen_preprocess_maintenance_page() calls
* this function to have consistent variables.
*/
function wundertheme_preprocess_html(&$variables, $hook) {
$theme_path = drupal_get_path('theme', 'wundertheme');
drupal_add_css( $theme_path . '/stylesheets/ie.css',
array(
'group' => CSS_THEME,
'browsers' => array(
'IE' => 'lt IE 9',
'!IE' => FALSE,
),
'weight' => 999,
'every_page' => TRUE,
'media' => 'screen, projection'
)
);
drupal_add_css( $theme_path . '/stylesheets/style.css',
array(
'group' => CSS_THEME,
'browsers' => array(
'IE' => 'gt IE 8',
'!IE' => TRUE,
),
'weight' => 999,
'every_page' => TRUE,
'media' => 'screen, projection'
)
);
drupal_add_css( $theme_path . '/stylesheets/print.css',
array(
'group' => CSS_THEME,
'weight' => 999,
'every_page' => TRUE,
'media' => 'print'
)
);
}
/**
* Implements theme_breadcrumb()
*
* Return a themed breadcrumb trail.
*
* @param $breadcrumb
* An array containing the breadcrumb links.
* @return a string containing the breadcrumb output.
*/
function wundertheme_breadcrumb($variables) {
$item = menu_get_item();
$variables['breadcrumb'][] = drupal_get_title();
$breadcrumb = $variables['breadcrumb'];
if (!empty($breadcrumb)) {
// Provide a navigational heading to give context for breadcrumb links to
// screen-reader users. Make the heading invisible with .element-invisible.
$output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
$output .= '<div class="breadcrumb">' . implode(' > ', $breadcrumb) . '</div>';
return $output;
}
}
/**
* Implements template_preprocess_button().
*
* @param $variables
* An array of variables to pass to the theme function.
*
*/
function wundertheme_preprocess_button(&$variables) {
// Rewrite the drupal classes for buttons so we can consistently theme them.
$variables['element']['#attributes']['class'][] = 'button';
if (isset($variables['element']['#value'])) {
$classes = array(
//specifics
t('Save and add') => '',
t('Add another item') => '',
t('Add effect') => '',
t('Add and configure') => '',
t('Update style') => '',
t('Download feature') => '',
//generals
t('Save') => '',
t('Apply') => '',
t('Create') => '',
t('Confirm') => '',
t('Submit') => '',
t('Export') => '',
t('Import') => '',
t('Restore') => '',
t('Rebuild') => '',
t('Search') => '',
t('Add') => '',
t('Update') => '',
t('Delete') => 'alert',
t('Remove') => 'alert',
);
foreach ($classes as $search => $class) {
if (strpos($variables['element']['#value'], $search) !== FALSE) {
$variables['element']['#attributes']['class'][] = $class;
break;
}
}
}
}