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 // 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; } }
/** * Implements hook_preprocess_region(). */ function openomega_preprocess_region(&$vars) { global $language; switch ($vars['region']) { // menu region case 'menu': $dropdown_menu = menu_tree_output(_openomega_menu_build_tree('main-menu', array('max_depth' => 2))); //set the active trail $active_trail = menu_get_active_trail(); foreach ($active_trail as $trail) { if (isset($trail['mlid']) && isset($dropdown_menu[$trail['mlid']])) { $dropdown_menu[$trail['mlid']]['#attributes']['class'][] = 'active-trail'; } } // Set the tab index for those with drop downs so can access the links. foreach ($dropdown_menu as $key => $item) { if (!empty($dropdown_menu[$key]['#below'])) { $dropdown_menu[$key]['#attributes']['tabindex'] = 0; } } $vars['dropdown_menu'] = $dropdown_menu; break; // default footer content // default footer content case 'footer_first': $footer_menu = menu_tree_output(_openomega_menu_build_tree('main-menu', array('max_depth' => 2))); //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']; } break; } }