public function setup()
 {
     parent::setup();
     $this->useFields();
     $options = array('file_src' => '', 'is_image' => true, 'with_delete' => true, 'delete_label' => sfContext::getInstance()->getI18N()->__('remove the current photo'), 'label' => false, 'edit_mode' => !$this->isNew());
     $key = 'photo';
     if (!$this->isNew()) {
         sfContext::getInstance()->getConfiguration()->loadHelpers('Partial');
         $options['template'] = get_partial('communityTopic/formEditImage', array('image' => $this->getObject()));
         $this->setValidator($key . '_delete', new sfValidatorBoolean(array('required' => false)));
     }
     $this->setWidget($key, new sfWidgetFormInputFileEditable($options, array('size' => 40)));
     $this->setValidator($key, new opValidatorImageFile(array('required' => false)));
 }
示例#2
0
 /**
  * (non-PHPdoc)
  * @see sfForm::setup()
  */
 public function setup()
 {
     parent::setup();
     $this->embeddedFormsSaveTime = array(self::EMBEDDED_FORM_SAVE_BEFORE => array(), self::EMBEDDED_FORM_SAVE_AFTER => array());
     $this->setupNestedSet();
 }