mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix closing motive render
This commit is contained in:
parent
b32fa42afa
commit
8523f14214
@ -23,12 +23,15 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
*
|
||||
* @implements ChillEntityRenderInterface<ClosingMotive>
|
||||
*/
|
||||
class ClosingMotiveRender implements ChillEntityRenderInterface
|
||||
final readonly class ClosingMotiveRender implements ChillEntityRenderInterface
|
||||
{
|
||||
use BoxUtilsChillEntityRenderTrait;
|
||||
private const SEPARATOR = ' > ';
|
||||
|
||||
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {}
|
||||
public function __construct(
|
||||
private TranslatableStringHelper $translatableStringHelper,
|
||||
private TranslatorInterface $translator
|
||||
) {}
|
||||
|
||||
public function renderBox($entity, array $options): string
|
||||
{
|
||||
@ -55,7 +58,7 @@ class ClosingMotiveRender implements ChillEntityRenderInterface
|
||||
private function renderStringRecursive(ClosingMotive $motive, string $existing, array $options)
|
||||
{
|
||||
$newExisting = $this->translatableStringHelper->localize($motive->getName());
|
||||
$isCancled = $motive->getIsCanceledAccompanyingPeriod() ? $this->translator->trans('( Canceled period )') : '';
|
||||
$isCanceled = $motive->getIsCanceledAccompanyingPeriod() ? $this->translator->trans('( Canceled period )') : '';
|
||||
|
||||
if ($motive->hasParent()) {
|
||||
if ('' !== $existing) {
|
||||
@ -64,7 +67,7 @@ class ClosingMotiveRender implements ChillEntityRenderInterface
|
||||
|
||||
return $this->renderStringRecursive(
|
||||
$motive->getParent(),
|
||||
$newExisting . ' ' . $isCancled,
|
||||
$newExisting . ' ' . $isCanceled,
|
||||
$options
|
||||
);
|
||||
}
|
||||
@ -73,6 +76,6 @@ class ClosingMotiveRender implements ChillEntityRenderInterface
|
||||
return $newExisting . self::SEPARATOR . $existing;
|
||||
}
|
||||
|
||||
return $newExisting . ' ' . $isCancled;
|
||||
return $newExisting . ' ' . $isCanceled;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user