Author: jablko
Date: Tue Nov  2 21:08:26 2010
New Revision: 8764

Log:
Add existing event type to <select/> choices, fixes issue 1597

Modified:
   trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/_event.php
   trunk/vendor/symfony/lib/form/sfFormField.class.php

Modified: trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/_event.php
==============================================================================
--- trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/_event.php        
Tue Nov  2 18:51:42 2010        (r8763)
+++ trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/_event.php        
Tue Nov  2 21:08:26 2010        (r8764)
@@ -30,7 +30,7 @@
           <td>
             <div class="animateNicely">
               <input name="<?php echo 
$form->getWidgetSchema()->generateName('id') ?>" type="hidden" value="<?php 
echo url_for(array($item, 'module' => 'event')) ?>"/>
-              <?php echo $form->getWidgetSchema()->renderField('type', 
url_for(array($item->type, 'module' => 'term'))) ?>
+              <?php $save = $form->type->choices; $form->type->choices += 
array(url_for(array($item->type, 'module' => 'term')) => $item->type); echo 
$form->getWidgetSchema()->renderField('type', url_for(array($item->type, 
'module' => 'term'))); $form->type->choices = $save ?>
             </div>
           </td><td>
             <div class="animateNicely">

Modified: trunk/vendor/symfony/lib/form/sfFormField.class.php
==============================================================================
--- trunk/vendor/symfony/lib/form/sfFormField.class.php Tue Nov  2 18:51:42 
2010        (r8763)
+++ trunk/vendor/symfony/lib/form/sfFormField.class.php Tue Nov  2 21:08:26 
2010        (r8764)
@@ -16,7 +16,7 @@
  * @author     Fabien Potencier <[email protected]>
  * @version    SVN: $Id: sfFormField.class.php 22401 2009-09-25 03:49:27Z 
Kris.Wallsmith $
  */
-class sfFormField
+class sfFormField implements ArrayAccess
 {
   protected static
     $toStringException = null;
@@ -329,8 +329,50 @@
 
     array_unshift($args, $name);
 
-    
call_user_func_array(array($clone->parent->getWidget()->offsetGet($clone->name),
 'setOption'), $args);
+    
call_user_func_array(array($clone->parent->getWidget()->__get($clone->name), 
'setOption'), $args);
 
     return $clone;
   }
+
+  public function offsetExists($offset)
+  {
+    $args = func_get_args();
+
+    return call_user_func_array(array($this, '__isset'), $args);
+  }
+
+  public function __get($name)
+  {
+    $args = func_get_args();
+
+    return 
call_user_func_array(array($this->parent->getWidget()->__get($this->name), 
'getOption'), $args);
+  }
+
+  public function offsetGet($offset)
+  {
+    $args = func_get_args();
+
+    return call_user_func_array(array($this, '__get'), $args);
+  }
+
+  public function __set($name, $value)
+  {
+    $args = func_get_args();
+
+    return 
call_user_func_array(array($this->parent->getWidget()->__get($this->name), 
'setOption'), $args);
+  }
+
+  public function offsetSet($offset, $value)
+  {
+    $args = func_get_args();
+
+    return call_user_func_array(array($this, '__set'), $args);
+  }
+
+  public function offsetUnset($offset)
+  {
+    $args = func_get_args();
+
+    return call_user_func_array(array($this, '__unset'), $args);
+  }
 }

-- 
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