wip render box person thirdparty display bloc

This commit is contained in:
2021-07-27 23:15:52 +02:00
parent 89dfea74b3
commit df3d32c653
12 changed files with 412 additions and 264 deletions

View File

@@ -2,7 +2,7 @@
/*
* Chill is a software for social workers
*
* Copyright (C) 2014-2019, Champs Libres Cooperative SCRLFS,
* Copyright (C) 2014-2019, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
@@ -35,7 +35,7 @@ class PersonRender extends AbstractChillEntityRender
private ConfigPersonAltNamesHelper $configAltNamesHelper;
private EngineInterface $engine;
public function __construct(
ConfigPersonAltNamesHelper $configAltNamesHelper,
EngineInterface $engine
@@ -43,9 +43,9 @@ class PersonRender extends AbstractChillEntityRender
$this->configAltNamesHelper = $configAltNamesHelper;
$this->engine = $engine;
}
/**
*
*
* @param Person $person
* @param array $options
* @return string
@@ -56,13 +56,16 @@ class PersonRender extends AbstractChillEntityRender
[
'person' => $person,
'addAltNames' => $this->configAltNamesHelper->hasAltNames(),
'addLink' => $options['addLink'] ?? false
'addLink' => $options['addLink'] ?? false,
'addEntity' => $options['addEntity'] ?? false,
'addInfo' => $options['addInfo'] ?? false,
'display' => $options['display'] ?? 'raw'
]
);
}
/**
*
*
* @param Person $person
* @param array $options
* @return string
@@ -76,7 +79,7 @@ class PersonRender extends AbstractChillEntityRender
protected function addAltNames(Person $person, bool $addSpan)
{
$str = '';
if ($this->configAltNamesHelper->hasAltNames()) {
$altNames = $this->configAltNamesHelper->getChoices();
$isFirst = true;
@@ -94,18 +97,18 @@ class PersonRender extends AbstractChillEntityRender
$str .= '<span class="chill-entity__person__alt-name chill-entity__person__altname--'.$altName->getKey().'">';
}
$str .= $altName->getLabel();
if ($addSpan) {
$str .= "</span>";
}
}
}
if (!$isFirst) {
$str .= ")";
}
}
return $str;
}