Author: jablko
Date: Thu Oct 28 11:45:11 2010
New Revision: 8633

Log:
Pass "multiple" option to renderer instead of reimplementing it? Fixes issue 
1804

Modified:
   trunk/vendor/symfony/lib/widget/sfWidgetFormChoice.class.php

Modified: trunk/vendor/symfony/lib/widget/sfWidgetFormChoice.class.php
==============================================================================
--- trunk/vendor/symfony/lib/widget/sfWidgetFormChoice.class.php        Thu Oct 
28 11:38:48 2010        (r8632)
+++ trunk/vendor/symfony/lib/widget/sfWidgetFormChoice.class.php        Thu Oct 
28 11:45:11 2010        (r8633)
@@ -76,21 +76,6 @@
    */
   public function render($name, $value = null, $attributes = array(), $errors 
= array())
   {
-    if ($this->getOption('multiple'))
-    {
-      $attributes['multiple'] = 'multiple';
-
-      if ('[]' != substr($name, -2))
-      {
-        $name .= '[]';
-      }
-    }
-
-    if (!$this->getOption('renderer') && !$this->getOption('renderer_class') 
&& $this->getOption('expanded'))
-    {
-      unset($attributes['multiple']);
-    }
-
     return $this->getRenderer()->render($name, $value, $attributes, $errors);
   }
 
@@ -127,6 +112,13 @@
       $class = sprintf('sfWidgetFormSelect%s', ucfirst($type));
     }
 
-    return new $class(array_merge(array('choices' => new 
sfCallable(array($this, 'getChoices'))), $this->options['renderer_options']), 
$this->getAttributes());
+    $options = $this->options['renderer_options'];
+    $options['choices'] = new sfCallable(array($this, 'getChoices'));
+    if (!$this->getOption('expanded'))
+    {
+      $options += array('multiple' => $this->getOption('multiple'));
+    }
+
+    return new $class($options, $this->getAttributes());
   }
 }

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" 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/qubit-commits?hl=en.

Reply via email to