From 046f65f5ff408ad6e0862aae82666bf926144f56 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 28 Oct 2021 09:45:27 +0200 Subject: [PATCH] person: re-add accpet email and add possibility of hidding this field --- .../ChillPersonBundle/DependencyInjection/Configuration.php | 1 + src/Bundle/ChillPersonBundle/Form/PersonType.php | 5 +++++ .../ChillPersonBundle/Resources/views/Person/edit.html.twig | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php index bf2d18922..4218174eb 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php @@ -82,6 +82,7 @@ class Configuration implements ConfigurationInterface ->append($this->addFieldNode('accompanying_period')) ->append($this->addFieldNode('memo')) ->append($this->addFieldNode('number_of_children')) + ->append($this->addFieldNode('acceptEmail')) ->arrayNode('alt_names') ->defaultValue([]) ->arrayPrototype() diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php index 85b8619c2..abe4750f2 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php @@ -166,6 +166,11 @@ class PersonType extends AbstractType ->add('email', EmailType::class, array('required' => false)); } + if ($this->config['acceptEmail'] === 'visible') { + $builder + ->add('acceptEmail', CheckboxType::class, array('required' => false)); + } + if ($this->config['country_of_birth'] === 'visible') { $builder->add('countryOfBirth', Select2CountryType::class, array( 'required' => false diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig index a8fc88f5e..80c1e76f9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig @@ -95,6 +95,11 @@
{{ form_row(form.email, {'label': 'Email'}) }}
+ {% endif %} + {%- if form.acceptEmail is defined -%} +
+ {{ form_row(form.acceptEmail, {'label' : 'Accept emails ?'}) }} +
{%- endif -%} {%- if form.phonenumber is defined -%}