-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.php
113 lines (104 loc) · 3.89 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
<?php
/**
* @file
* This file is empty by default because the base theme chain (Alpha & Omega) provides
* all the basic functionality. However, in case you wish to customize the output that Drupal
* generates through Alpha & Omega this file is a good place to do so.
*
* Alpha comes with a neat solution for keeping this file as clean as possible while the code
* for your subtheme grows. Please read the README.txt in the /preprocess and /process subfolders
* for more information on this topic.
*/
/**
* Unset the Alpha/Omega themes from the appearance page
* We don't want anyone enabling them directly
*
* Needs moved to module since theme isn't used for admin, but keeping here for reference
*/
function open_omega_system_themes_page_alter(&$theme_groups) {
$hidden = array(
'alpha', 'omega',
);
foreach ($theme_groups as $state => &$group) {
if ($state == 'disabled') {
foreach ($theme_groups[$state] as $id => &$theme) {
if(in_array($theme, $hidden)) {
unset($theme_groups[$state][$id]);
}
}
}
}
}
function openomega_preprocess_region(&$vars) {
global $language;
switch($vars['region']) {
// menu region
case 'menu':
$footer_menu_cache = cache_get("footer_menu_data:". $language->language) ;
if ($footer_menu_cache) {
$footer_menu = $footer_menu_cache->data;
}
else {
$footer_menu = menu_tree_output(_openomega_menu_build_tree('main-menu', array('max_depth'=>2)));
cache_set("footer_menu_data:" .$language->language, $footer_menu);
}
//set the active trail
$active_trail = menu_get_active_trail();
foreach($active_trail as $trail) {
if (isset($trail['mlid']) && isset($footer_menu[$trail['mlid'] ] )) {
$footer_menu[$trail['mlid']]['#attributes']['class'][] = 'active-trail';
}
}
$vars['dropdown_menu'] = $footer_menu;
break;
// default footer content
case 'footer_first':
$footer_menu_cache = cache_get("footer_menu_data:". $language->language) ;
if ($footer_menu_cache) {
$footer_menu = $footer_menu_cache->data;
}
else {
$footer_menu = menu_tree_output(_openomega_menu_build_tree('main-menu', array('max_depth'=>2)));
cache_set("footer_menu_data", $footer_menu);
}
//set the active trail
$active_trail = menu_get_active_trail();
foreach($active_trail as $trail) {
if (isset($trail['mlid']) && isset($footer_menu[$trail['mlid'] ] )) {
$footer_menu[$trail['mlid']]['#attributes']['class'][] = 'active-trail';
}
}
$vars['footer_menu'] = $footer_menu;
$vars['site_name'] = $site_name = variable_get('site_name');
$vars['footer_logo'] = l(theme('image', array('path'=>drupal_get_path('theme', 'openomega') . "/logo-sm.png", 'alt'=>"$site_name logo")), '', array("html"=>TRUE, 'attributes'=>array('class'=>'logo')));
if(function_exists('defaultcontent_get_node') && ($node = defaultcontent_get_node("email_update")) ) {
$node = node_view($node);
$vars['subscribe_form'] = $node['webform'];
}
//krumo($vars['footer_menu']);
break;
}
}
/* Fix the horrid menu_tree theme function to clearfix since most LI's are floated */
function openomega_menu_tree($variables) {
return '<ul class="menu clearfix">' . $variables['tree'] . '</ul>';
}
/* Add the 'clearfix' class to all unformatted views rows */
function openomega_preprocess_views_view_unformatted(&$vars) {
foreach($vars['classes'] as &$rowclasses) {
$rowclasses[] = 'clearfix';
}
foreach($vars['classes_array'] as &$rowclasses) {
$rowclasses .= ' clearfix';
}
foreach($vars['attributes_array']['class'] as &$rowclasses) {
$rowclasses .= ' clearfix';
}
}
function _openomega_menu_build_tree($menu_name, $parameters = array()) {
$tree = menu_build_tree($menu_name, $parameters);
if (function_exists('i18n_menu_localize_tree')) {
$tree = i18n_menu_localize_tree($tree);
}
return $tree;
}