src/FormSubscriber/WorkSheetValue/WorkSheetValueAttachmentFormSubscriber.php line 35

Open in your IDE?
  1. <?php
  2. /*
  3.  * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
  4.  * Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
  5.  */
  6. namespace App\FormSubscriber\WorkSheetValue;
  7. use App\Entity\WorkSheetValueAttachment;
  8. use Symfony\Component\Form\FormEvent;
  9. use Symfony\Component\Form\FormEvents;
  10. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  11. use Kematjaya\UploadBundle\Type\KmjFileType;
  12. /**
  13.  * Description of WorkSheetValueAttachmentFormSubscriber
  14.  *
  15.  * @author programmer
  16.  */
  17. class WorkSheetValueAttachmentFormSubscriber implements WorkSheetValueFormSubscriberInterface 
  18. {
  19.     public function isSupported(string $className): bool 
  20.     {
  21.         return WorkSheetValueAttachment::class === $className;
  22.     }
  23.     public static function getSubscribedEvents() 
  24.     {
  25.         return [
  26.             FormEvents::POST_SET_DATA => 'postSetData'
  27.         ];
  28.     }
  29.     
  30.     public function postSetData(FormEvent $event):void
  31.     {
  32.         $event->getForm()
  33.                 ->add('attachment'KmjFileType::class, [
  34.                     "label" => "attachment",
  35.                     "required" => true,
  36.                     "additional_path" => "area_point"
  37.                 ])
  38.                 ->add('description'TextareaType::class, [
  39.                     "label" => "description",
  40.                     "required" => false
  41.                 ]);
  42.     }
  43. }