I use Symfony 5.3, EasyAdmin 3.5, and Vich/Uploader-bundle 1.19 I want to manage uploads of PDF files into a EAsyAdmin CRUD controller.
Here is the configuration of my fields for this CRUD Controller
public function configureFields(string $pageName): iterable
{
return [
Field::new('document')->setFormType(VichFileType::class, [
'download_label' => 'Télécharger',
'allow_delete' => false,
])
];
}
But in my EasyAdmin Update Page, here is my result :
It seems that the options passed in my VichFileType are not used. Further more, the default option for 'download_label' does not use french translation provided with Vich/Upload-bundle.
Do you have any idea ? Do You thinks it's a bug from my code of from VichUpload ?
Thanks for your help !
CodePudding user response:
I found the solution, by using the command
Field::new('document')
->setFormType(VichFileType::class)
->setFormTypeOptions(
[
'download_label' => 'Télécharger',
'allow_delete' => false,
])
CodePudding user response:
You should use the FormType, it's easier.
You put the imageFile in your form then your show the imageName in your twig.