forked from tomkuipers/uva_sitebuilder_huisstijl
/
template.php
124 lines (112 loc) · 3.6 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
<?php
/**
* @file
* Process theme data.
*
* Use this file to run your theme specific implimentations of theme functions,
* such preprocess, process, alters, and theme function overrides.
*
* Preprocess and process functions are used to modify or create variables for
* templates and theme functions. They are a common theming tool in Drupal often
* used as an alternative to directly editing or adding code to templates. Its
* worth spending some time to learn more about these functions - they are a
* powerful way to easily modify the output of any template variable.
*
* Preprocess and Process Functions SEE:
* http://drupal.org/node/254940#variables-processor
*
* 1. Rename each function and instance of "sitebuilder_uva" to match your
* subthemes name, e.g. if your theme name is "footheme" then the function
* name will be "footheme_preprocess_hook". Tip - you can search/replace on
* "sitebuilder_uva".
* 2. Uncomment the required function to use.
*/
/**
* Override or insert variables for the page templates.
*/
function sitebuilder_uva_preprocess_page(&$vars) {
// Provide a variable to all templates to test for a mobile context, this
// requires the Browscap module and returns TRUE or FALSE.
}
/**
* Shows listing of asset metadata.
*
* The theme used to generate a listing of metadata in the views using
* mediamosa_ck_views_field_text_metadata. Slightly modified from the original:
* no showing of empty rows.
*
* @param array $variables
* Data used for the theme.
*/
function sitebuilder_uva_mediamosa_ck_views_theme_asset_metadata($variables) {
$rows = array();
ksort($variables['metadata']);
foreach ($variables['metadata'] as $name => $value) {
if (is_array($value)) {
$value = implode("\n", $value);
}
$name = drupal_ucfirst(str_replace('_', ' ', $name));
if (empty($value)) {
$rows[] = array('class' => array('empty'), 'data' => array('name' => $name, 'value' => ''));
}
else {
$rows[] = array('data' => array('name' => $name, 'value' => nl2br(check_plain($value))));
}
}
if (empty($rows)) {
$rows[] = array('-', '');
}
return theme('table', array('rows' => $rows));
}
/**
* Returns HTML for the Powered by MediaMosa.
*
* @ingroup themeable
*/
function sitebuilder_uva_mediamosa_sb_powered_by_mediamosa() {
$image = theme('image', array(
'path' => drupal_get_path('module', 'mediamosa_sb') . '/images/logo32.png',
'alt' => t('Powered by MediaMosa'),
'title' => t('Powered by MediaMosa'),
)
);
$output = '<div class="mediamosa-logo-small">';
$output .= l($image, 'http://mediamosa.org', array('attributes' => array(), 'html' => TRUE));
$output .= '</div>';
return $output;
}
/**
* Implements template_process_html().
*
* Override or insert variables into the page template for HTML output.
*/
function sitebuilder_uva_process_html(&$variables) {
// Hook into color.module.
if (module_exists('color')) {
_color_html_alter($variables);
}
}
/**
* Implements template_process_page().
*/
function sitebuilder_uva_process_page(&$variables, $hook) {
// Hook into color.module.
if (module_exists('color')) {
_color_page_alter($variables);
}
}
/**
* Create themed owner field.
*/
function sitebuilder_uva_mediamosa_ck_views_theme_owner($variables) {
if (module_exists('surfconext')) {
$u = user_load($variables['uid']);
if (isset($u->display_name) && isset($u->display_name['und'][0]['value'])) {
return $u->display_name['und'][0]['value'];
}
else {
return '-';
}
}
theme_mediamosa_ck_views_theme_owner($variables);
}