function spartan_preprocess_region in OpenPublic 7
Implements hook_preprocess_region().
File
- themes/
spartan/ template.php, line 33 - Code for the spartan theme.
Code
function spartan_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(_spartan_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(_spartan_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['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', 'spartan') . "/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;
}
}