first impl for global timeline: apply on activities

This commit is contained in:
2021-05-14 16:25:56 +02:00
parent 8c98f2cf6e
commit c3ef8d112c
18 changed files with 604 additions and 98 deletions

View File

@@ -23,6 +23,8 @@ namespace Chill\PersonBundle\Templating\Entity;
use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
use Symfony\Component\Templating\EngineInterface;
/**
* Render a Person
@@ -30,15 +32,16 @@ use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
*/
class PersonRender extends AbstractChillEntityRender
{
/**
*
* @var ConfigPersonAltNamesHelper
*/
protected $configAltNamesHelper;
private ConfigPersonAltNamesHelper $configAltNamesHelper;
private EngineInterface $engine;
public function __construct(ConfigPersonAltNamesHelper $configAltNamesHelper)
{
public function __construct(
ConfigPersonAltNamesHelper $configAltNamesHelper,
EngineInterface $engine
) {
$this->configAltNamesHelper = $configAltNamesHelper;
$this->engine = $engine;
}
/**
@@ -49,13 +52,13 @@ class PersonRender extends AbstractChillEntityRender
*/
public function renderBox($person, array $options): string
{
return
$this->getDefaultOpeningBox('person').
'<span class="chill-entity__person__first-name">'.$person->getFirstName().'</span>'.
' <span class="chill-entity__person__last-name">'.$person->getLastName().'</span>'.
$this->addAltNames($person, true).
$this->getDefaultClosingBox()
;
return $this->engine->render('@ChillPerson/Entity/person.html.twig',
[
'person' => $person,
'addAltNames' => $this->configAltNamesHelper->hasAltNames(),
'addLink' => $options['addLink'] ?? false
]
);
}
/**
@@ -69,7 +72,7 @@ class PersonRender extends AbstractChillEntityRender
return $person->getFirstName().' '.$person->getLastName()
.$this->addAltNames($person, false);
}
protected function addAltNames(Person $person, bool $addSpan)
{
$str = '';