mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
improve layout of third parties in AddPerson
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
namespace Chill\ThirdPartyBundle\Templating\Entity;
|
||||
|
||||
use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Symfony\Component\Templating\EngineInterface;
|
||||
|
||||
@@ -32,10 +33,15 @@ class ThirdPartyRender extends AbstractChillEntityRender
|
||||
{
|
||||
|
||||
protected EngineInterface $engine;
|
||||
protected TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(EngineInterface $engine)
|
||||
public function __construct(
|
||||
EngineInterface $engine,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
)
|
||||
{
|
||||
$this->engine = $engine;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +82,18 @@ class ThirdPartyRender extends AbstractChillEntityRender
|
||||
*/
|
||||
public function renderString($entity, array $options): string
|
||||
{
|
||||
return $entity->getName();
|
||||
if ($entity->getCivility() !== NULL) {
|
||||
$civility = $this->translatableStringHelper
|
||||
->localize($entity->getCivility()->getAbbreviation()).' ';
|
||||
} else {
|
||||
$civility = '';
|
||||
}
|
||||
if (!empty($entity->getAcronym())) {
|
||||
$acronym = ' ('.$entity->getAcronym().')';
|
||||
} else {
|
||||
$acronym = '';
|
||||
}
|
||||
return $civility.$entity->getName().$acronym;
|
||||
}
|
||||
|
||||
public function supports($entity, array $options): bool
|
||||
|
Reference in New Issue
Block a user