diff --git a/context.module b/context.module index 637ffd8..d06c4af 100644 --- a/context.module +++ b/context.module @@ -179,6 +179,29 @@ function context_init() { } /** + * Implementation of hook_preprocess_HOOK(). + */ +function context_preprocess_menu_link(&$variables) { + if($contexts = context_active_contexts()){ + foreach($contexts as $context){ + if((isset($context->reactions['menu']))){ + if ($variables['element']['#href'] == $context->reactions['menu']) { + $variables['element']['#localized_options']['attributes']['class'][] = "active"; + } + } + } + } + $element = $variables['element']; + $sub_menu = ''; + + if ($element['#below']) { + $sub_menu = drupal_render($element['#below']); + } + $output = l($element['#title'], $element['#href'], $element['#localized_options']); + return '' . $output . $sub_menu . "\n"; +} + +/** * Load & crud functions ============================================== */