person: capitalise place of birth (frontend + backend)

This commit is contained in:
nobohan 2021-10-14 22:33:31 +02:00
parent 6a1cf4eb92
commit b800b62e88
2 changed files with 15 additions and 9 deletions

View File

@ -35,6 +35,7 @@ use Chill\PersonBundle\Form\Type\Select2MaritalStatusType;
use Symfony\Component\Form\AbstractType;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\CommentType;
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;
@ -114,7 +115,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') {
@ -192,6 +205,7 @@ class PersonType extends AbstractType
array('attr' => array('class' => 'cf-fields'), 'group' => $options['cFGroup']))
;
}
}
/**

View File

@ -143,11 +143,3 @@
{% block js %}
{{ encore_entry_script_tags('page_person') }}
{% endblock %}
{% block css %}
<style>
input#chill_personbundle_person_placeOfBirth {
text-transform: uppercase;
}
</style>
{% endblock %}