mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
Remove custom service definitions.
This commit is contained in:
@@ -5,9 +5,10 @@ namespace Chill\PersonBundle\Templating\Entity;
|
||||
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Templating\EngineInterface;
|
||||
|
||||
class SocialIssueRender implements ChillEntityRenderInterface
|
||||
final class SocialIssueRender implements ChillEntityRenderInterface
|
||||
{
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
private EngineInterface $engine;
|
||||
@@ -28,11 +29,14 @@ class SocialIssueRender implements ChillEntityRenderInterface
|
||||
{
|
||||
return $entity instanceof SocialIssue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param SocialIssue $socialIssue
|
||||
*/
|
||||
public function renderString($socialIssue, array $options): string
|
||||
{
|
||||
/** @var $socialIssue SocialIssue */
|
||||
$options = \array_merge(self::DEFAULT_ARGS, $options);
|
||||
$options = array_merge(self::DEFAULT_ARGS, $options);
|
||||
|
||||
$str = $this->translatableStringHelper->localize($socialIssue->getTitle());
|
||||
|
||||
@@ -46,26 +50,36 @@ class SocialIssueRender implements ChillEntityRenderInterface
|
||||
return $str;
|
||||
}
|
||||
|
||||
protected function buildParents($socialIssue): array
|
||||
protected function buildParents(SocialIssue $socialIssue): array
|
||||
{
|
||||
$parents = [];
|
||||
|
||||
while ($socialIssue->hasParent()) {
|
||||
$socialIssue = $parents[] = $socialIssue->getParent();
|
||||
}
|
||||
|
||||
return $parents;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param SocialIssue $socialIssue
|
||||
*/
|
||||
public function renderBox($socialIssue, array $options): string
|
||||
{
|
||||
$options = \array_merge(self::DEFAULT_ARGS, $options);
|
||||
$options = array_merge(self::DEFAULT_ARGS, $options);
|
||||
// give some help to twig: an array of parents
|
||||
$parents = $this->buildParents($socialIssue);
|
||||
|
||||
return $this->engine->render('@ChillPerson/Entity/social_issue.html.twig', [
|
||||
'socialIssue' => $socialIssue,
|
||||
'parents' => $parents,
|
||||
'options' => $options
|
||||
]);
|
||||
return $this
|
||||
->engine
|
||||
->render(
|
||||
'@ChillPerson/Entity/social_issue.html.twig',
|
||||
[
|
||||
'socialIssue' => $socialIssue,
|
||||
'parents' => $parents,
|
||||
'options' => $options
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user