]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Add current class to selected menu items
authorZach Copley <zach@status.net>
Thu, 9 Jun 2011 23:29:19 +0000 (19:29 -0400)
committerZach Copley <zach@status.net>
Thu, 9 Jun 2011 23:29:19 +0000 (19:29 -0400)
lib/action.php

index 920bbf31b9f32cec8fab23986b35fc2ceaf3b854..21e5f78db13567c0e406c922ca77382c2e62d54b 100644 (file)
@@ -1351,14 +1351,17 @@ class Action extends HTMLOutputter // lawsuit
     {
         // Added @id to li for some control.
         // XXX: We might want to move this to htmloutputter.php
-        $lattrs = array();
+        $lattrs  = array();
+        $classes = array();
         if ($class !== null) {
-            $lattrs['class'] = $class;
-            if ($is_selected) {
-                $lattrs['class'] = trim('current ' . $lattrs['class']);
-            }
+            $classes[] = trim($class);
+        }
+        if ($is_selected) {
+            $classes[] = 'current';
         }
 
+        $lattrs['class'] = implode(' ', $classes);
+
         (is_null($id)) ? $lattrs : $lattrs['id'] = $id;
 
         $this->elementStart('li', $lattrs);