diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig index 47f15f07b..dfe703c01 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig @@ -7,6 +7,7 @@ * addEntity bool * addId bool * addInfo bool + * addAge bool * hLevel integer * customButtons [ 'before' Twig\Markup, (injected with macro) @@ -60,6 +61,11 @@ {{ 'Born the date'|trans({'gender': person.gender, 'birthdate': person.birthdate|format_date("medium") }) }} + {%- if options['addAge'] -%} + + {{ person.age ~ ((person.age > 1) ? ' ans' : ' an') }} + + {%- endif -%}

{%- endif -%} {#- tricks to remove easily whitespace after template -#} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/banner.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/banner.html.twig index 5389edb85..cd02a81f3 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/banner.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/banner.html.twig @@ -5,9 +5,8 @@
{{ person|chill_entity_render_box({ - 'render': 'label', 'addInfo': true, 'addId': true, 'hLevel': 1 + 'render': 'label', 'addInfo': true, 'addAge': true, 'addId': true, 'hLevel': 1 }) }} -
@@ -68,9 +67,6 @@ {% else %} {{ person.birthdate|format_date('short') }} {% endif %} - - {{ person.age ~ ((person.age > 1) ? ' ans' : ' an') }} -
{%- if chill_person.fields.nationality == 'visible' -%} diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php index 2b66f7581..b95252fde 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php @@ -57,6 +57,7 @@ class PersonRender extends AbstractChillEntityRender 'addEntity' => $options['addEntity'] ?? false, 'addId' => $options['addId'] ?? false, 'addInfo' => $options['addInfo'] ?? false, + 'addAge' => $options['addAge'] ?? false, 'hLevel' => $options['hLevel'] ?? 3, 'customButtons' => $options['customButtons'] ?? [], ];