src/FormSubscriber/WorkSheetValue/WorkSheetValueKlasifikasiFormSubscriber.php line 36

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\WorksheetValueKlasifikasi;
  8. use Symfony\Component\Form\FormEvent;
  9. use Symfony\Component\Form\FormEvents;
  10. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  11. use Symfony\Component\Form\Extension\Core\Type\TextType;
  12. /**
  13.  * Description of WorkSheetValueKlasifikasiFormSubscriber
  14.  *
  15.  * @author programmer
  16.  */
  17. class WorkSheetValueKlasifikasiFormSubscriber implements WorkSheetValueFormSubscriberInterface 
  18. {
  19.     
  20.     public function isSupported(string $className): bool 
  21.     {
  22.         return WorksheetValueKlasifikasi::class === $className;
  23.     }
  24.     public static function getSubscribedEvents() 
  25.     {
  26.         return [
  27.             FormEvents::POST_SET_DATA => 'postSetData'
  28.         ];
  29.     }
  30.     public function postSetData(FormEvent $event):void
  31.     {
  32.         $event->getForm()
  33.                 ->add('code'TextType::class, [
  34.                     "label" => "code",
  35.                     "required" => true
  36.                 ])
  37.                 ->add('description'TextareaType::class, [
  38.                     "label" => "description",
  39.                     "required" => false
  40.                 ]);
  41.     }
  42. }