N°8771 - Add Symfony form component to iTop core

- IO
This commit is contained in:
Benjamin Dalsass
2025-10-24 08:35:10 +02:00
parent 7708f8e00e
commit a1025ac837
5 changed files with 133 additions and 77 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace Combodo\iTop\Forms\FormBuilder;
use Symfony\Component\Form\Event\PostSetDataEvent;
use Symfony\Component\Form\Event\PostSubmitEvent;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
class FormHelper
{
/**
* Get the event type.
*
* @param FormEvent $event
*
* @return string
* @throws FormBuilderException
*/
public static function GetEventType(FormEvent $event): string
{
if ($event instanceof PostSetDataEvent) {
return FormEvents::POST_SET_DATA;
} else if ($event instanceof PostSubmitEvent) {
return FormEvents::POST_SUBMIT;
}
throw new FormBuilderException(sprintf('Unknown event type %s', get_class($event)));
}
}