Skip to content

Instantly share code, notes, and snippets.

@caefer
Created August 19, 2010 12:22
Show Gist options
  • Save caefer/537740 to your computer and use it in GitHub Desktop.
Save caefer/537740 to your computer and use it in GitHub Desktop.
class BarfooArticleForm extends BaseBarfooArticleForm
{
public function configure()
{
$file_src = sfContext::getInstance()->getController()->genUrl(array(
'sf_route' => 'sf_image',
'format' => 'backend_edit',
'type' => 'BarfooArticle',
'attribute' => 'topImage',
'slug' => $this->getObject()->slug,
'id' => $this->getObject()->id
), false);
$this->widgetSchema['topImage'] = new sfWidgetFormInputFileEditable(array(
'label' => 'Image',
'is_image' => true,
'file_src' => $file_src
));
$this->validatorSchema['topImage'] = new sfValidatorFile(array(
'required' => false,
'path' => sfConfig::get('sf_upload_dir').'/barfooarticle',
'mime_types' => 'web_images',
));
$this->validatorSchema['topImage_delete'] = new sfValidatorPass();
$file_src = sfContext::getInstance()->getController()->genUrl(array(
'sf_route' => 'sf_image',
'format' => 'backend_edit',
'type' => 'BarfooArticle',
'attribute' => 'centerImage',
'slug' => $this->getObject()->slug,
'id' => $this->getObject()->id
), false);
$this->widgetSchema['centerImage'] = new sfWidgetFormInputFileEditable(array(
'label' => 'Image',
'is_image' => true,
'file_src' => $file_src
));
$this->validatorSchema['centerImage'] = new sfValidatorFile(array(
'required' => false,
'path' => sfConfig::get('sf_upload_dir').'/barfooarticle',
'mime_types' => 'web_images',
));
$this->validatorSchema['centerImage_delete'] = new sfValidatorPass();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment