add age in some place and re-organize some usage of the component

This commit is contained in:
2022-01-31 12:45:50 +01:00
parent 186b8847d9
commit e04c02055c
13 changed files with 39 additions and 35 deletions

View File

@@ -76,7 +76,9 @@ class PersonRender extends AbstractChillEntityRender
*/
public function renderString($person, array $options): string
{
if (null !== $person->getAge() && $person->getDeathDate() === null) {
$options = array_merge(['addAge' => true], $options);
if (null !== $person->getAge() && $person->getDeathDate() === null && $options['addAge']) {
return $person->getFirstName() . ' ' . $person->getLastName()
. $this->addAltNames($person, false) . ' (' . $this->translator->trans('years_old', ['age' => $person->getAge()]) . ')';
}