]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
switched to matching by link name - same results, simpler code
authorMatt Beckett <beck24@gmail.com>
Wed, 18 Jul 2012 04:39:49 +0000 (22:39 -0600)
committerMatt Beckett <beck24@gmail.com>
Wed, 18 Jul 2012 04:39:49 +0000 (22:39 -0600)
engine/lib/navigation.php

index 8845d5164f9f28b3a3cbc37f8c5f25223676224a..a9d28e22e063ab18d72f6e97a1f3847d614f9fa1 100644 (file)
@@ -321,21 +321,12 @@ function elgg_site_menu_setup($hook, $type, $return, $params) {
        }
        
        if (!$selected) {
-               // nothing selected, match by handler
-               $handler = get_input('handler');
-               
+               // nothing selected, match name to context
                foreach ($return as $section_name => $section) {
                        foreach ($section as $key => $item) {
-                               // determine the 'handler' of this url, if there is one
+                               // only highlight internal links
                                if (strpos($item->getHref(), elgg_get_site_url()) === 0) {
-                                       // this is an internal link, so it has a page handler
-                                       $path = array(str_replace(elgg_get_site_url(), '', $item->getHref()));
-                                       $separators = array('/', '?', '#');
-                                       foreach ($separators as $separator) {
-                                               $path = explode($separator, $path[0]);
-                                       }
-                                       
-                                       if ($path[0] == $handler) {
+                                       if ($item->getName() == elgg_get_context()) {
                                                $return[$section_name][$key]->setSelected(true);
                                                break 2;
                                        }