fix conflict in CHANGELOG

This commit is contained in:
nobohan
2021-11-08 12:41:11 +01:00
21 changed files with 287 additions and 127 deletions

View File

@@ -22,6 +22,7 @@
namespace Chill\PersonBundle\Form;
use Chill\CustomFieldsBundle\Form\Type\CustomFieldType;
use Chill\MainBundle\Entity\Civility;
use Chill\MainBundle\Form\Type\ChillCollectionType;
use Chill\MainBundle\Form\Type\ChillTextareaType;
use Chill\MainBundle\Form\Type\Select2CountryType;
@@ -35,6 +36,11 @@ use Chill\PersonBundle\Form\Type\Select2MaritalStatusType;
use Symfony\Component\Form\AbstractType;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\CommentType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TelType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
@@ -62,16 +68,20 @@ class PersonType extends AbstractType
*/
protected $configAltNamesHelper;
protected TranslatableStringHelper $translatableStringHelper;
/**
*
* @param string[] $personFieldsConfiguration configuration of visibility of some fields
*/
public function __construct(
array $personFieldsConfiguration,
ConfigPersonAltNamesHelper $configAltNamesHelper
ConfigPersonAltNamesHelper $configAltNamesHelper,
TranslatableStringHelper $translatableStringHelper
) {
$this->config = $personFieldsConfiguration;
$this->configAltNamesHelper = $configAltNamesHelper;
$this->translatableStringHelper = $translatableStringHelper;
}
/**
@@ -114,7 +124,19 @@ class PersonType extends AbstractType
}
if ($this->config['place_of_birth'] === 'visible') {
$builder->add('placeOfBirth', TextType::class, array('required' => false));
$builder->add('placeOfBirth', TextType::class, array(
'required' => false,
'attr' => ['style' => 'text-transform: uppercase;'],
));
$builder->get('placeOfBirth')->addModelTransformer(new CallbackTransformer(
function ($string) {
return strtoupper($string);
},
function ($string) {
return strtoupper($string);
}
));
}
if ($this->config['contact_info'] === 'visible') {
@@ -150,7 +172,11 @@ class PersonType extends AbstractType
if ($this->config['email'] === 'visible') {
$builder
->add('email', EmailType::class, array('required' => false))
->add('email', EmailType::class, array('required' => false));
}
if ($this->config['acceptEmail'] === 'visible') {
$builder
->add('acceptEmail', CheckboxType::class, array('required' => false));
}
@@ -173,6 +199,23 @@ class PersonType extends AbstractType
));
}
if ($this->config['civility'] === 'visible'){
$builder
->add('civility', EntityType::class, [
'label' => 'Civility',
'class' => Civility::class,
'choice_label' => function (Civility $civility): string {
return $this->translatableStringHelper->localize($civility->getName());
},
'query_builder' => function (EntityRepository $er): QueryBuilder {
return $er->createQueryBuilder('c')
->where('c.active = true');
},
'placeholder' => 'choose civility',
'required' => false
]);
}
if ($this->config['marital_status'] === 'visible'){
$builder
->add('maritalStatus', Select2MaritalStatusType::class, array(
@@ -192,6 +235,7 @@ class PersonType extends AbstractType
array('attr' => array('class' => 'cf-fields'), 'group' => $options['cFGroup']))
;
}
}
/**