From 02716a6a93f1865d03505cd527039a6e8cea8594 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 16 Feb 2022 15:55:26 +0100 Subject: [PATCH] PersonRender: adapt twig template to suffixText --- .../Resources/views/Entity/person.html.twig | 6 ++++++ .../ChillPersonBundle/Templating/Entity/PersonRender.php | 1 + .../Templating/Entity/PersonRenderInterface.php | 1 - 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig index 9bee504a9..d415426cd 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig @@ -12,6 +12,7 @@ * hLevel integer * addDeath bool * addAgeBadge bool + * suffixText bool * address_multiline bool * customButtons [ 'before' Twig\Markup, (injected with macro) @@ -46,6 +47,11 @@ ({{- 'years_old'|trans({ 'age': person.age }) -}}) {% endif %} {% endif %} + {%- if options['suffixText'] is defined -%} + {% for o in options['suffixText'] %} + {{ o }} + {% endfor %} + {% endif %} {% endmacro raw %} {% macro label(person, options) %} diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php index 1fcf71486..2815aa41f 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php @@ -60,6 +60,7 @@ class PersonRender extends AbstractChillEntityRender implements PersonRenderInte 'customArea' => $options['customArea'] ?? [], 'addDeath' => $options['addDeath'] ?? true, 'addAgeBadge' => $options['addAgeBadge'] ?? false, + 'suffixText' => $options['suffixText'] ?? [], ]; return diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php index b4514a8c2..631402851 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRenderInterface.php @@ -12,7 +12,6 @@ declare(strict_types=1); namespace Chill\PersonBundle\Templating\Entity; use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface; -use Chill\PersonBundle\Entity\Person; /** * Render a Person.