forked from ssn65/elsinore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.php
131 lines (111 loc) · 3.56 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
<?php
/**
* @file
* Template overrides and theme functions for Elsinore theme.
*/
/**
* Overrides dynamo filefield icon.
*/
function elsinore_filefield_icon($file) {
$icon = '';
// Cast file to object for uniform access.
if (is_object($file)) {
$file = (array) $file;
}
$alt = t('PDF file');
if ($icon_url = filefield_icon_url($file)) {
$icon = theme('image', $icon_url, t('PDF file'));
}
return $icon;
}
/**
* Override of theme_ting_search_form().
*/
function elsinore_ting_search_form($form) {
$form['submit']['#type'] = "submit";
$form['submit']['#src'] = drupal_get_path('theme', 'elsinore') . "/images/searchbutton.png";
$form['submit']['#attributes']['class'] = "";
return drupal_render($form);
}
/**
* Override of theme_user_login_block().
*/
function elsinore_user_login_block($form) {
$name = drupal_render($form['name']);
$pass = drupal_render($form['pass']);
$submit = drupal_render($form['submit']);
$remember = drupal_render($form['remember_me']);
return $name . $pass . $submit . $remember . drupal_render($form) . '<div class="new_loaner"><div><a href="/DIN+SIDE/Ny+låner%3F">Sådan bliver du låner...</a></div></div>';
}
/**
* Override of theme_menu_item_link().
*/
function elsinore_menu_item_link($link) {
if ($link['href'] == 'http://nolink') {
return '<span class="nolink">' . check_plain($link['title']) . '</span>';
}
else {
return theme_menu_item_link($link);
}
}
/**
* Preprocess page template variables.
*/
function elsinore_preprocess_page(&$variables) {
if (!empty($variables['admin'])) {
$variables['body_classes'] .= ' admin';
}
}
/**
* Preprocess node template variables.
*/
function elsinore_preprocess_node(&$variables) {
if ($variables['type'] == 'page' && isset($variables['field_page_type'][0]['safe'])) {
$page_type = $variables['field_page_type'][0]['safe'];
if (!empty($page_type)) {
$variables['classes'] .= ' page-type-' . $page_type;
}
}
}
/**
* Preprocess library location pane template variables.
*/
function elsinore_preprocess_ding_panels_content_library_location(&$variables) {
$node = $variables['node'];
// Add a static Google map to the location information.
if (function_exists('location_has_coordinates') && location_has_coordinates($node->location)) {
$map_url = url('http://maps.google.com/maps/api/staticmap', array('query' => array(
'zoom' => 14,
'size' => '210x210',
'markers' => $node->location['latitude'] . ',' . $node->location['longitude'],
'sensor' => 'false',
)));
$variables['library_map'] = theme('image', $map_url, '', '', NULL, FALSE);
}
}
/**
* Preprocess library title pane template variables.
*/
function elsinore_preprocess_ding_panels_content_library_title(&$variables) {
if (isset($variables['library_links'])) {
$variables['library_links']['events'] = l('Det sker', $variables['base_url'] . '/arrangementer');
$variables['library_navigation'] = theme('item_list', $variables['library_links']);
}
}
/**
* Preprocess ting objects.
*/
function elsinore_preprocess_ting_object(&$variables) {
$object = $variables['object'];
// Want all subjects on one line. We do that by pretending there is
// only one subject that is the concatenation of all the subjects.
$object->subjects = array(implode(', ', $object->subjects));
// Reverse order of buttons.
$variables['buttons'] = array_reverse($variables['buttons']);
}
/**
* Preprocess ting list item.
*/
function elsinore_preprocess_ting_list_item(&$variables) {
$variables['buttons'] = array_reverse($variables['buttons']);
}