Newer
Older
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
<?php
function unl_wdn_get_instance()
{
static $instance;
if (!$instance) {
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/lib');
require_once "UNL/Templates.php";
UNL_Templates::$options['version'] = UNL_Templates::VERSION3;
$instance = UNL_Templates::factory('Fixed');
}
return $instance;
}
//include dirname(__FILE__) . '/includes/form.inc';
function unl_wdn_breadcrumb($variables)
{
$breadcrumbs = $variables['breadcrumb'];
if (count($breadcrumbs) == 0) {
$breadcrumbs[] = variable_get('site_name', 'Department');
} else {
//Change 'Home' to be $site_name
array_unshift($breadcrumbs,
str_replace('Home', variable_get('site_name', 'Department'),
array_shift($breadcrumbs)));
}
//Prepend UNL
array_unshift($breadcrumbs, '<a href="http://www.unl.edu/">UNL</a>');
//Append title of current page -- http://drupal.org/node/133242
$breadcrumbs[] = drupal_get_title();
$html = '<ul>' . PHP_EOL;
foreach ($breadcrumbs as $breadcrumb) {
$html .= '<li>' . $breadcrumb . '</li>';
}
$html .= '</ul>';
return $html;
}
function unl_wdn_head_title()
{
// Based on
// http://api.drupal.org/api/function/menu_get_active_breadcrumb/5
// We don't have to add the current page, as drupal normally drops it
$path[] = 'Home';
// $trail = _menu_get_active_trail();
$trail = array();
foreach ($trail as $mid) {
$item = menu_get_item($mid);
if ($item['type'] & MENU_VISIBLE_IN_BREADCRUMB) {
$path[] = $item['title'];
}
}
// Change 'Home' to be $site_name
array_unshift($path, str_replace( 'Home', variable_get('site_name', 'Department'), array_shift($path)));
//Prepend UNL
array_unshift($path, 'UNL');
return implode(' | ', $path);
}
function unl_wdn_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL)
{
if ($extra_class) {
return '<li class="' . $extra_class . '">' . $link . $menu . '</li>' . "\n";
} else {
return '<li>' . $link . $menu . '</li>' . PHP_EOL;
}
}
function unl_wdn_menu_tree($variables)
{
$tree = $variables['tree'];
return '<ul>' . $tree . '</ul>' . PHP_EOL;
}
function unl_wdn_theme()
{
return array('page_node_form' => array('arguments' => array('form' => NULL),));
}
function unl_wdn_menu_local_tasks()
{
$output = array();
if ($primary = menu_primary_local_tasks()) {
$primary['#prefix'] = '<ul class="wdn_tabs disableSwitching">';
$primary['#suffix'] = '</ul>';
$output[] = $primary;
}
if ($secondary = menu_secondary_local_tasks()) {
$secondary['#prefix'] = '<ul class="wdn_tabs disableSwitching">';
$secondary['#suffix'] = '</ul>';
$output[] = $secondary;
}
return $output;
}
function unl_wdn_menu_local_task($variables)
{
$link = $variables['element']['#link'];
$link_text = $link['title'];
if (!empty($variables['element']['#active'])) {
// If the link does not contain HTML already, check_plain() it now.
// After we set 'html'=TRUE the link will not be sanitized by l().
if (empty($link['localized_options']['html'])) {
$link['title'] = check_plain($link['title']);
}
$link['localized_options']['html'] = TRUE;
$link_text = t('!local-task-title !active', array('!local-task-title' => $link['title'], '!active' => ''));
}
return '<li' . (!empty($variables['element']['#active']) ? ' class="selected"' : '') . '>' . l($link_text, $link['href'], $link['localized_options']) . "</li>\n";
}
function unl_wdn_status_messages($display)
{
foreach (drupal_get_messages($display) as $type => $messages) {
$output .= '<div>' . PHP_EOL;
if (count($messages) > 1) {
$output .= '<ul>' . PHP_EOL;
foreach ($messages as $message) {
$output .= '<li>' . $message . '</li>' . PHP_EOL;
}
$output .= '</ul>' . PHP_EOL;
} else {
$output .= $messages[0];
}
$output .= '</div>' . PHP_EOL;
}
return $output;
}