-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.php
159 lines (134 loc) · 4.98 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
<?php
/**
* @file
* Preprocess, process and theme Functions.
*/
/**
* Implements theme_menu_link().
*
* Add specific markup for top-bar menu exposed as menu_block_4.
*/
function wellejus_menu_link__menu_tabs_menu($vars) {
// Check for our 'openhours' link
if ($vars['element']['#href'] == 'openhours') {
list($element, $sub_menu) = _wellejust_process_menu_links($vars);
$element['#localized_options']['attributes']['class'][] = 'js-topbar-link';
// Insert a 'clock' fa icon before openhours menu-link.
$title_prefix = '<i class="icon-time"></i>';
$element['#localized_options']['attributes']['class'][] = 'topbar-link-hours';
$element['#attributes']['class'][] = 'topbar-link-hours';
$output = l($title_prefix . '<span>' . $element['#title'] . '</span>', $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
// If it wasn't our link; pass on the rendering to DDBasic.
return ddbasic_menu_link__menu_tabs_menu($vars);
}
/**
* Implements theme_menu_link().
*/
function wellejus_menu_link__menu_secondary_menu($vars) {
list($element, $sub_menu) = _wellejust_process_menu_links($vars);
$title_prefix = '';
switch ($element['#href']) {
case 'https://www.facebook.com/vejlebibliotekerne':
$title_prefix = '<i class="icon-large icon-facebook-sign"></i>';
break;
case 'contact':
$title_prefix = '<i class="icon-large icon-envelope"></i>';
break;
}
$output = l($title_prefix . '<span>' . $element['#title'] . '</span>', $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
/**
* Implements theme_menu_link()
*/
function wellejus_menu_link__main_menu(&$vars) {
list($element, $sub_menu) = _wellejust_process_menu_links($vars);
$title_prefix = '';
switch (drupal_get_path_alias($element['#href'])) {
case '<front>':
$title_prefix = '<i class="icon-large icon-home"></i>';
break;
case 'arrangementer':
$title_prefix = '<i class="icon-large icon-calendar"></i>';
break;
case 'inspiration':
$title_prefix = '<i class="icon-large icon-lightbulb"></i>';
break;
case 'netmedier':
$title_prefix = '<i class="icon-large icon-globe"></i>';
break;
case 'sadan-gor-du':
$title_prefix = '<i class="icon-large icon-wrench"></i>';
break;
}
$output = l($title_prefix . '<span>' . $element['#title'] . '</span>', $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
/**
* Helper function for default processing of menu link elements.
*/
function _wellejust_process_menu_links(&$vars) {
$element = $vars['element'];
$sub_menu = '';
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
// Add default class to a tag.
$element['#localized_options']['attributes']['class'] = array(
'menu-item',
);
// Filter classes.
$element['#attributes']['class'] = ddbasic_remove_default_link_classes($element['#attributes']['class']);
// Make sure text string is treated as html by l function.
$element['#localized_options']['html'] = TRUE;
return array($element, $sub_menu);
}
/**
* Implements theme_menu_tree().
*/
function wellejus_menu_tree__menu_information_menu(&$vars) {
return '<ul class="information-menu">' . $vars['tree'] . '</ul>';
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function wellejus_form_search_block_form_alter(&$form, &$form_state) {
$form['search_block_form']['#title'] = t('Search');
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function wellejus_form_user_login_block_alter(&$form, &$form_state) {
$form['name']['#title_display'] = 'invisible';
$form['pass']['#title_display'] = 'invisible';
}
/**
* Implements hook_js_alter().
*/
function wellejus_js_alter(&$js) {
// Override the ding_tabroll module js, so that we can adjust the rotation speed
$module_path = drupal_get_path('module', 'ding_tabroll') . '/js/ding_tabroll.js';
if (isset($js[$module_path])) {
$theme_path = drupal_get_path('theme', 'wellejus') . '/scripts/wellejus.ding_tabroll.js';
// Copy the settings
$js[$theme_path] = $js[$module_path];
// Override the data
$js[$theme_path]['data'] = $theme_path;
unset($js[$module_path]);
}
}
/**
* Implements hook_preprocess_ting_object().
*/
function wellejus_preprocess_ting_object(&$vars) {
if (isset($vars['elements']['#view_mode']) && $vars['elements']['#view_mode'] == 'full') {
// ting_object and ting_collection entities use the same template.
if (isset($vars['elements']['#entity_type']) && $vars['elements']['#entity_type'] == 'ting_object') {
$holdings = $vars['content']['holdings-available'];
$vars['content']['holdings-available'] = $vars['content']['material-details'];
$vars['content']['material-details'] = $holdings;
}
}
}