mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-25 16:14:59 +00:00
Add external identifiers for person, editable in edit form, with minimal features associated
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\PersonIdentifier\Rendering;
|
||||
|
||||
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
|
||||
use Chill\PersonBundle\Entity\Identifier\PersonIdentifier;
|
||||
use Chill\PersonBundle\PersonIdentifier\PersonIdentifierManagerInterface;
|
||||
|
||||
/**
|
||||
* @template-implements ChillEntityRenderInterface<PersonIdentifier>
|
||||
*/
|
||||
final readonly class PersonIdentifierEntityRender implements ChillEntityRenderInterface
|
||||
{
|
||||
public function __construct(private PersonIdentifierManagerInterface $identifierManager) {}
|
||||
|
||||
public function renderBox(mixed $entity, array $options): string
|
||||
{
|
||||
return $this->renderString($entity, $options);
|
||||
}
|
||||
|
||||
public function renderString(mixed $entity, array $options): string
|
||||
{
|
||||
$worker = $this->identifierManager->buildWorkerByPersonIdentifierDefinition($entity->getDefinition());
|
||||
|
||||
return $worker->renderAsString($entity);
|
||||
}
|
||||
|
||||
public function supports(object $entity, array $options): bool
|
||||
{
|
||||
return $entity instanceof PersonIdentifier;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user