-
Notifications
You must be signed in to change notification settings - Fork 1
/
template.php
139 lines (121 loc) · 3.91 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
<?php
/**
* @file
* template.php
*/
function rula_preprocess_region(&$variables) {
if ($variables['region'] == 'header') {
array_push($variables['classes_array'], 'clearfix');
}
}
/**
* Implements hook_preprocess_page().
*
* @see page.tpl.php
*/
function rula_preprocess_page(&$variables) {
// Add font awesome cdn.
drupal_add_css('//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css', array(
'type' => 'external'
));
// Add information about the number of sidebars.
if ((!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) && !empty($variables['page']['sidebar_third'])) {
$variables['content_column_class'] = ' class="col-sm-6"';
}
elseif (!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second']) || !empty($variables['page']['sidebar_third'])) {
$variables['content_column_class'] = ' class="col-sm-9"';
}
else {
$variables['content_column_class'] = ' class="col-sm-12"';
}
// Primary nav.
$variables['primary_nav'] = FALSE;
if ($variables['main_menu']) {
// Build links.
$variables['primary_nav'] = menu_tree(variable_get('menu_main_links_source', 'main-menu'));
// Provide default theme wrapper function.
$variables['primary_nav']['#theme_wrappers'] = array('menu_tree__primary');
}
// Secondary nav.
$variables['secondary_nav'] = FALSE;
if ($variables['secondary_menu']) {
// Build links.
$variables['secondary_nav'] = menu_tree(variable_get('menu_secondary_links_source', 'user-menu'));
// Provide default theme wrapper function.
$variables['secondary_nav']['#theme_wrappers'] = array('menu_tree__secondary');
}
$variables['navbar_classes_array'] = array('navbar');
if (theme_get_setting('bootstrap_navbar_position') !== '') {
$variables['navbar_classes_array'][] = 'navbar-' . theme_get_setting('bootstrap_navbar_position');
}
else {
$variables['navbar_classes_array'][] = 'container';
}
if (theme_get_setting('bootstrap_navbar_inverse')) {
$variables['navbar_classes_array'][] = 'navbar-inverse';
}
else {
$variables['navbar_classes_array'][] = 'navbar-default';
}
// $viewport = array(
// '#tag' => 'meta',
// '#attributes' => array(
// 'name' => 'viewport',
// 'content' => 'width=465, initial-scale=1.0'
// )
// );
// drupal_add_html_head($viewport, 'viewport');
}
/**
* Implements hook_process_page().
*
* @see page.tpl.php
*/
function rula_process_page(&$variables) {
$variables['navbar_classes'] = implode(' ', $variables['navbar_classes_array']);
}
/**
* Returns HTML for an islandora_solr_facet_wrapper.
*
* @param array $variables
* An associative array containing:
* - title: A string to use as the header/title.
* - content: A string containing the content being wrapped.
*
* @ingroup themeable
*/
function rula_islandora_solr_facet_wrapper($variables) {
//
// <div class="panel-group" id="accordion">
// <div class="panel panel-default">
// <div class="panel-heading">
// <h4 class="panel-title">
// <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
// Collapsible Group Item #1
// </a>
// </h4>
// </div>
// <div id="collapseOne" class="panel-collapse collapse in">
// <div class="panel-body">
// ...
// </div>
// </div>
// </div>
//
$t = $variables["title"];
$tl = strtolower($t);
$output = '<div class="islandora-solr-facet-wrapper">';
$output .= '<div class="panel panel-default">';
$output .= '<div class="panel-heading">';
$output .= '<h3>' . $t . '</h3>';
$output .= '<button type="button" class="btn btn-primary collapsed" data-toggle="collapse" data-target="#collapse-'.$tl.'">-</button>';
$output .= '</div>';
$output .= '<div id="collapse-'.$tl.'" class="panel-collapse collapse in">';
$output .= '<div class="panel-body">';
$output .= $variables['content'];
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
return $output;
}