- ->add('user', HiddenEntityType::class, ['required' => true])
- ->add('description', TextareaType::class, ['attr' => ['placeholder' => 'Your description', 'cols' => 50, 'rows' => 15], 'required' => false])
- ->add('class', TextareaType::class, ['attr' => ['placeholder' => 'Your class', 'cols' => 50, 'rows' => 10], 'required' => false])
- ->add('short', TextareaType::class, ['attr' => ['placeholder' => 'Your short', 'cols' => 50, 'rows' => 10], 'required' => false])
- ->add('rate', NumberType::class, ['attr' => ['placeholder' => 'Your rate'], 'required' => false])
- ->add('contact', UrlType::class, ['attr' => ['placeholder' => 'Your contact'], 'required' => false])
- ->add('donate', UrlType::class, ['attr' => ['placeholder' => 'Your donate'], 'required' => false])
- ->add('link', UrlType::class, ['attr' => ['placeholder' => 'Your link'], 'required' => false])
- ->add('profile', UrlType::class, ['attr' => ['placeholder' => 'Your profile'], 'required' => false])
- ->add('image', FileType::class, ['attr' => ['placeholder' => 'Your image'], 'constraints' => [new File(['maxSize' => '5M', 'mimeTypes' => ['image/jpeg', 'image/png', 'image/tiff', 'image/webp'], 'mimeTypesMessage' => 'Please upload a valid Image document'])], 'mapped' => false, 'required' => false])
- ->add('submit', SubmitType::class, ['label' => 'Send', 'attr' => ['class' => 'submit']]);
+ ->add('user', HiddenEntityType::class, ['required' => true]);
+
+ //With description
+ if ($options['description']) {
+ $form->add('description', TextareaType::class, ['attr' => ['placeholder' => 'Your description', 'cols' => 50, 'rows' => 15], 'required' => false]);
+ }
+
+ //With class
+ if ($options['class']) {
+ $form->add('class', TextareaType::class, ['attr' => ['placeholder' => 'Your class', 'cols' => 50, 'rows' => 10], 'required' => false]);
+ }
+
+ //With short
+ if ($options['short']) {
+ $form->add('short', TextareaType::class, ['attr' => ['placeholder' => 'Your short', 'cols' => 50, 'rows' => 10], 'required' => false]);
+ }
+
+ //With rate
+ if ($options['rate']) {
+ $form->add('rate', NumberType::class, ['attr' => ['placeholder' => 'Your rate'], 'required' => false]);
+ }
+
+ //With hat
+ if ($options['hat']) {
+ $form->add('hat', CheckboxType::class, ['attr' => ['placeholder' => 'Your hat'], 'required' => false]);
+ }
+
+ //With contact
+ if ($options['contact']) {
+ $form->add('contact', UrlType::class, ['attr' => ['placeholder' => 'Your contact'], 'required' => false]);
+ }
+
+ //With donate
+ if ($options['donate']) {
+ $form->add('donate', UrlType::class, ['attr' => ['placeholder' => 'Your donate'], 'required' => false]);
+ }
+
+ //With link
+ if ($options['link']) {
+ $form->add('link', UrlType::class, ['attr' => ['placeholder' => 'Your link'], 'required' => false]);
+ }
+
+ //With profile
+ if ($options['profile']) {
+ $form->add('profile', UrlType::class, ['attr' => ['placeholder' => 'Your profile'], 'required' => false]);
+ }
+
+ //Add submit
+ $form->add('submit', SubmitType::class, ['label' => 'Send', 'attr' => ['class' => 'submit']]);
+
+ //Return form builder
+ return $form;