<?php
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
*/
namespace App\FormSubscriber\WorkSheetValue;
use App\Entity\WorkSheetValueAttachment;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Kematjaya\UploadBundle\Type\KmjFileType;
/**
* Description of WorkSheetValueAttachmentFormSubscriber
*
* @author programmer
*/
class WorkSheetValueAttachmentFormSubscriber implements WorkSheetValueFormSubscriberInterface
{
public function isSupported(string $className): bool
{
return WorkSheetValueAttachment::class === $className;
}
public static function getSubscribedEvents()
{
return [
FormEvents::POST_SET_DATA => 'postSetData'
];
}
public function postSetData(FormEvent $event):void
{
$event->getForm()
->add('attachment', KmjFileType::class, [
"label" => "attachment",
"required" => true,
"additional_path" => "area_point"
])
->add('description', TextareaType::class, [
"label" => "description",
"required" => false
]);
}
}