コード例 #1
0
 protected function addField($name)
 {
     switch ($name) {
         case 'type':
             foreach (sfIsadPlugin::eventTypes() as $item) {
                 // Default event type is creation
                 if (QubitTerm::CREATION_ID == $item->id) {
                     $this->form->setDefault('type', $this->context->routing->generate(null, array($item, 'module' => 'term')));
                 }
                 $choices[$this->context->routing->generate(null, array($item, 'module' => 'term'))] = $item->__toString();
             }
             $this->form->setValidator('type', new sfValidatorString());
             $this->form->setWidget('type', new sfWidgetFormSelect(array('choices' => $choices)));
             break;
         default:
             return parent::addField($name);
     }
 }