allow to hide memo

This commit is contained in:
Julien Fastré 2018-08-27 13:23:36 +02:00
parent f2ed32e458
commit 4513ef35f6
4 changed files with 11 additions and 4 deletions

View File

@ -75,6 +75,7 @@ class Configuration implements ConfigurationInterface
->append($this->addFieldNode('spoken_languages'))
->append($this->addFieldNode('address'))
->append($this->addFieldNode('accompanying_period'))
->append($this->addFieldNode('memo'))
->end() //children for 'person_fields', parent = array 'person_fields'
->end() // person_fields, parent = children of root
->end() // children of 'root', parent = root

View File

@ -68,9 +68,13 @@ class PersonType extends AbstractType
->add('birthdate', DateType::class, array('required' => false, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
->add('gender', GenderType::class, array(
'required' => true
))
->add('memo', TextareaType::class, array('required' => false))
));
if ($this->config['memo'] === 'visible') {
$builder
->add('memo', TextareaType::class, array('required' => false))
;
}
if ($this->config['place_of_birth'] === 'visible') {
$builder->add('placeOfBirth', TextType::class, array('required' => false));

View File

@ -28,10 +28,12 @@
{{ form_start(form) }}
{% if form.memo is defined %}
<fieldset>
<legend><h2>{{ 'Memo'|trans }}</h2></legend>
{{ form_row(form.memo, {'label' : 'Memo'} ) }}
{{ form_row(form.memo, {'label' : 'Memo'} ) }}
</fieldset>
{% endif %}
<fieldset>
<legend><h2>{{ 'General information'|trans }}</h2></legend>

View File

@ -41,7 +41,7 @@ This view should receive those arguments:
<div class="person-view">
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
{% if person.memo is not empty %}
{% if person.memo is not empty and chill_person.fields.memo == 'visible' %}
<div class="grid-12">
<figure class="person-details">
<h2 class="chill-red">{{ 'Memo'|trans }}</h2>