diff --git a/Form/PersonType.php b/Form/PersonType.php index aa76a3ba7..5b28575b3 100644 --- a/Form/PersonType.php +++ b/Form/PersonType.php @@ -24,29 +24,32 @@ namespace Chill\PersonBundle\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; + use Chill\PersonBundle\Form\Type\GenderType; +use Chill\MainBundle\Form\Type\Select2CountryType; +use Chill\MainBundle\Form\Type\Select2LanguageType; class PersonType extends AbstractType { /** * array of configuration for person_fields. - * - * Contains whether we should add fields some optional fields (optional per + * + * Contains whether we should add fields some optional fields (optional per * instance) * * @var string[] */ protected $config = array(); - + /** - * + * * @param string[] $personFieldsConfiguration configuration of visibility of some fields */ public function __construct(array $personFieldsConfiguration) { $this->config = $personFieldsConfiguration; } - + /** * @param FormBuilderInterface $builder * @param array $options @@ -62,38 +65,38 @@ class PersonType extends AbstractType )) ->add('memo', 'textarea', array('required' => false)) ; - + if ($this->config['place_of_birth'] === 'visible') { $builder->add('placeOfBirth', 'text', array('required' => false)); } - + if ($this->config['phonenumber'] === 'visible') { $builder->add('phonenumber', 'textarea', array('required' => false)); } - + if ($this->config['email'] === 'visible') { $builder->add('email', 'textarea', array('required' => false)); } - + if ($this->config['country_of_birth'] === 'visible') { - $builder->add('countryOfBirth', 'select2_chill_country', array( + $builder->add('countryOfBirth', Select2CountryType::class, array( 'required' => false )); } - + if ($this->config['nationality'] === 'visible') { - $builder->add('nationality', 'select2_chill_country', array( + $builder->add('nationality', Select2CountryType::class, array( 'required' => false )); } - + if ($this->config['spoken_languages'] === 'visible') { - $builder->add('spokenLanguages', 'select2_chill_language', array( + $builder->add('spokenLanguages', Select2LanguageType::class, array( 'required' => false, 'multiple' => true )); } - + if ($this->config['marital_status'] === 'visible'){ $builder->add('maritalStatus', 'select2_chill_marital_status', array( 'required' => false @@ -107,7 +110,7 @@ class PersonType extends AbstractType ; } } - + /** * @param OptionsResolverInterface $resolver */ diff --git a/Form/Type/Select2MaritalStatusType.php b/Form/Type/Select2MaritalStatusType.php index 4139a66ef..277286a24 100644 --- a/Form/Type/Select2MaritalStatusType.php +++ b/Form/Type/Select2MaritalStatusType.php @@ -26,6 +26,7 @@ use Chill\MainBundle\Form\Type\DataTransformer\ObjectToIdTransformer; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\HttpFoundation\RequestStack; use Doctrine\Common\Persistence\ObjectManager; +use Chill\MainBundle\Form\Type\Select2ChoiceType; /** * A type to select the marital status @@ -45,13 +46,13 @@ class Select2MaritalStatusType extends AbstractType $this->requestStack = $requestStack; $this->em = $em; } - + public function getName() { return 'select2_chill_marital_status'; } - + public function getParent() { - return 'select2_choice'; + return Select2ChoiceType::class; } public function buildForm(FormBuilderInterface $builder, array $options)