mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
first impl for global timeline: apply on activities
This commit is contained in:
@@ -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 = '';
|
||||
|
Reference in New Issue
Block a user