Author: francois.b
Date: 2010-03-18 19:40:15 +0100 (Thu, 18 Mar 2010)
New Revision: 28616

Modified:
   
plugins/sfUnobstrusiveWidgetPlugin/trunk/lib/widget/navigation/menu/sfUoWidgetMenu.class.php
Log:
[sfUnobstrusiveWidgetPlugin] added 'active_class' and 'active_tag' options in 
sfUoWidgetMenu.class.php

Modified: 
plugins/sfUnobstrusiveWidgetPlugin/trunk/lib/widget/navigation/menu/sfUoWidgetMenu.class.php
===================================================================
--- 
plugins/sfUnobstrusiveWidgetPlugin/trunk/lib/widget/navigation/menu/sfUoWidgetMenu.class.php
        2010-03-18 17:14:36 UTC (rev 28615)
+++ 
plugins/sfUnobstrusiveWidgetPlugin/trunk/lib/widget/navigation/menu/sfUoWidgetMenu.class.php
        2010-03-18 18:40:15 UTC (rev 28616)
@@ -31,9 +31,11 @@
   protected function configure($options = array(), $attributes = array())
   {
     parent::configure($options, $attributes);
-    
+
     $this->addOption('active', null);
+    $this->addOption('active_class', 'active');
     $this->addOption('active_onlink', true);
+    $this->addOption('active_tag', 'strong');
   }
 
   /**
@@ -57,7 +59,7 @@
           {
             $options['class'] = 'active';
           }
-          $value['label']   = $this->renderContentTag('strong', 
$value['label'], array());
+          $value['label']   = 
$this->renderContentTag($this->getOption('active_tag'), $value['label'], 
array());
         }
         $value['label'] = $this->renderContentTag('a', $value['label'], 
$options);
         unset($value['url']);
@@ -78,9 +80,9 @@
    */
   protected function renderItem($key, $content, $attributes = array())
   {
-    if (!$this->getOption('active_onlink') && strpos($content, '<strong>'))
+    if (!$this->getOption('active_onlink') && strpos($content, 
$this->getOption('active_tag')))
     {
-      $attributes['class'] = isset($attributes['class']) ? 
$attributes['class'].' active' : 'active';
+      $attributes['class'] = isset($attributes['class']) ? sprinft('%s %s', 
$attributes['class'], $this->getOption('active_class')) : 
$this->getOption('active_class');
     }
     return empty($content) ? '' : $this->renderContentTag('li', $content, 
$attributes);
   }

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to