mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
adapt UI and controller for Person without centers
This commit is contained in:
@@ -21,7 +21,9 @@
|
||||
|
||||
namespace Chill\PersonBundle\Form;
|
||||
|
||||
use Chill\MainBundle\Form\Event\CustomizeFormEvent;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
@@ -33,6 +35,7 @@ use Chill\PersonBundle\Form\Type\GenderType;
|
||||
use Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer;
|
||||
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
|
||||
use Chill\PersonBundle\Form\Type\PersonAltNameType;
|
||||
use Chill\MainBundle\Form\Type\Export\PickCenterType;
|
||||
|
||||
final class CreationPersonType extends AbstractType
|
||||
{
|
||||
@@ -40,10 +43,6 @@ final class CreationPersonType extends AbstractType
|
||||
// TODO: See if this is still valid and update accordingly.
|
||||
const NAME = 'chill_personbundle_person_creation';
|
||||
|
||||
const FORM_NOT_REVIEWED = 'not_reviewed';
|
||||
const FORM_REVIEWED = 'reviewed' ;
|
||||
const FORM_BEING_REVIEWED = 'being_reviewed';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var CenterTransformer
|
||||
@@ -56,12 +55,16 @@ final class CreationPersonType extends AbstractType
|
||||
*/
|
||||
protected $configPersonAltNamesHelper;
|
||||
|
||||
private EventDispatcherInterface $dispatcher;
|
||||
|
||||
public function __construct(
|
||||
CenterTransformer $centerTransformer,
|
||||
ConfigPersonAltNamesHelper $configPersonAltNamesHelper
|
||||
ConfigPersonAltNamesHelper $configPersonAltNamesHelper,
|
||||
EventDispatcherInterface $dispatcher
|
||||
) {
|
||||
$this->centerTransformer = $centerTransformer;
|
||||
$this->configPersonAltNamesHelper = $configPersonAltNamesHelper;
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +82,9 @@ final class CreationPersonType extends AbstractType
|
||||
->add('gender', GenderType::class, array(
|
||||
'required' => true, 'placeholder' => null
|
||||
))
|
||||
->add('center', CenterType::class)
|
||||
->add('center', CenterType::class, [
|
||||
'required' => false
|
||||
])
|
||||
;
|
||||
|
||||
if ($this->configPersonAltNamesHelper->hasAltNames()) {
|
||||
@@ -87,6 +92,11 @@ final class CreationPersonType extends AbstractType
|
||||
'by_reference' => false
|
||||
]);
|
||||
}
|
||||
|
||||
$this->dispatcher->dispatch(
|
||||
new CustomizeFormEvent(static::class, $builder),
|
||||
CustomizeFormEvent::NAME
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user