-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.php
More file actions
165 lines (151 loc) · 4.54 KB
/
Copy pathtemplate.php
File metadata and controls
165 lines (151 loc) · 4.54 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
<?php
/**
* @file
* Template overrides as well as (pre-)process and alter hooks for the
* Excellent Schools Detroit theme.
*/
/**
* Implements hook_omega_theme_libraries_info().
*/
function esd_omega_theme_libraries_info($theme) {
$path = drupal_get_path('theme', 'esd');
$libraries['selectnav'] = array(
'name' => t('Selectnav'),
'description' => t("selectnav.js library"),
'package' => t('esd'),
'files' => array(
'js' => array(
$path . '/js/selectnav/selectnav.min.js' => array(
'group' => JS_THEME,
'weight' => -100,
'every_page' => TRUE,
),
),
),
);
$libraries['responsive'] = array(
'name' => t('Responsive Libs'),
'description' => t('Responsive libraries and plugins'),
'package' => t('esd'),
'files' => array(
'js' => array(
$path . '/js/jquery.resizeend.js' => array(
'group' => JS_THEME,
'weight' => -101,
'every_page' => TRUE,
),
$path . '/js/jquery.matchmedia.js' => array(
'group' => JS_THEME,
'weight' => -100,
'every_page' => TRUE,
),
),
),
);
$libraries['esd_frontend'] = array(
'name' => t('Excellent Schools Detroit Frontend'),
'description' => t('esd frontend magic'),
'package' => t('esd'),
'files' => array(
'js' => array(
$path . '/js/esd_frontend.js' => array(
'group' => JS_THEME,
'weight' => 100,
'every_page' => TRUE,
),
),
),
);
$libraries['imgsizer'] = array(
'name' => t('ImgSizer'),
'description' => t('Image sizer plugin'),
'package' => t('esd'),
'files' => array(
'js' => array(
$path . '/js/imgsizer.js' => array(
'group' => JS_THEME,
'weight' => 80,
'every_page' => TRUE,
),
),
),
);
$libraries['superfish'] = array(
'name' => t('Superfish'),
'description' => t('Superfish dropdown menus'),
'package' => t('esd'),
'files' => array(
'js' => array(
$path . '/js/superfish.js' => array(
'group' => JS_THEME,
'weight' => 90,
'every_page' => TRUE,
),
),
),
);
return $libraries;
}
/**
* Implements template_preprocess_page
*/
function esd_preprocess_page(&$vars) {
drupal_add_js('jQuery.extend(Drupal.settings, { "pathToTheme": "/' . path_to_theme() . '/" });', 'inline');
if (is_object($vars['node'])) {
if ($vars['node']->type == 'blog_entry') {
// Set Page title to Blog on blog nodes.
$vars['title'] = l('Blog', 'blog');
}
if ($vars['node']->type == 'media_hit') {
// Set Page title to Media Archive on media hit nodes.
$vars['title'] = l('Media Archive', 'media');
}
}
}
/**
* Implements template_preprocess_node
*/
function esd_preprocess_node(&$vars) {
// Re-order the links.
$vars['content']['links'] = array_reverse($vars['content']['links']);
// Add wrapper & "from" to media outlet field
if (isset($vars['content']['field_media_outlet'])) {
$vars['content']['field_media_outlet']['#prefix'] = '<div class="media-hit-outlet-wrapper"><span class="italic">from</span>';
$vars['content']['field_media_outlet']['#suffix'] = '</div>';
}
if (isset($vars['content']['links']['translation'])) {
// Remove the language link on nodes.
unset($vars['content']['links']['translation']);
}
}
/**
* Implements template_preprocess_search_result().
*/
function esd_preprocess_search_result(&$vars) {
if ($vars['result']['language'] == 'es') {
$vars['lang_indicator'] = '<span class="es" title="' . t('Spanish') . '">ES</span>';
} else {
$vars['lang_indicator'] = '<span class="en" title="' . t('English') . '">EN</span>';
}
// Adds lang_path variable to search result.
if ($vars['result']['language'] != 'und') {
$vars['lang_path'] = '/' . $vars['result']['language'] . '/' . drupal_get_path_alias('node/' . $vars['result']['node']->nid, $vars['result']['language']);
} else {
$vars['lang_path'] = $vars['result']['link'];
}
}
/**
* Implements theme_file_icon().
*/
function esd_file_icon($variables) {
$file = $variables['file'];
if ($file->filemime == 'application/pdf') {
// Override PDF icon
$icon_directory = drupal_get_path('theme', 'esd') . '/images/file-icons';
} else {
$icon_directory = $variables['icon_directory'];
}
$mime = check_plain($file->filemime);
$icon_url = file_icon_url($file, $icon_directory);
return '<img alt="" class="file-icon" src="' . $icon_url . '" title="' . $mime . '" />';
}