1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| class BackendcountryForm extends BasecountryForm
{
public function configure()
{
parent::configure();
// Enlever croix rouge image manquante en modification :
if ($this->getObject()->getFlag() <> null)
{
$afficherflag = '<div>%file% <br />%input%<br />%delete% %delete_label%</div>';}
else{
$afficherflag = '<div><br />%input%<br />%delete% %delete_label%</div>';
}
$this->widgetSchema['flag'] = new sfWidgetFormInputFileEditable(array(
'label' => 'Country flag',
'file_src' => '/uploads/flags/'.$this->getObject()->getFlag(),
'is_image' => true,
'edit_mode' => !$this->isNew(),
'template' => $afficherflag
));
$this->setValidator('flag', new sfValidatorFile(array(
'mime_types' => 'web_images',
'path' => sfConfig::get('sf_upload_dir').'/flags',
'required' => false,
)));
$this->validatorSchema['flag_delete'] = new sfValidatorBoolean();
$this->embedI18n(array('en', 'fr'));
$this->widgetSchema->setLabel('en', 'English');
$this->widgetSchema->setLabel('fr', 'French');
$this->validatorSchema['country'] = new sfValidatorString(array('max_length' => 150));
}
} |
Partager