From e52c94aabd1b91853d1216378db9d848899db662 Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Fri, 4 Jun 2021 15:04:36 +0200 Subject: [PATCH] Use SocialIssueRenderer->renderString for displaying socialIssues --- src/Bundle/ChillActivityBundle/Form/ActivityType.php | 7 +++++-- src/Bundle/ChillActivityBundle/config/services/form.yaml | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index b890630ae..0332173eb 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -35,6 +35,7 @@ use Chill\MainBundle\Form\Type\ChillDateType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\CallbackTransformer; use Chill\PersonBundle\Form\DataTransformer\PersonToIdTransformer; +use Chill\PersonBundle\Templating\Entity\SocialIssueRender; class ActivityType extends AbstractType { @@ -53,7 +54,8 @@ class ActivityType extends AbstractType AuthorizationHelper $authorizationHelper, ObjectManager $om, TranslatableStringHelper $translatableStringHelper, - array $timeChoices + array $timeChoices, + SocialIssueRender $socialIssueRender ) { if (!$tokenStorage->getToken()->getUser() instanceof User) { throw new \RuntimeException("you should have a valid user"); @@ -64,6 +66,7 @@ class ActivityType extends AbstractType $this->om = $om; $this->translatableStringHelper = $translatableStringHelper; $this->timeChoices = $timeChoices; + $this->socialIssueRender = $socialIssueRender; } public function buildForm(FormBuilderInterface $builder, array $options): void @@ -108,7 +111,7 @@ class ActivityType extends AbstractType 'required' => $activityType->isRequired('socialIssues'), 'class' => SocialIssue::class, 'choice_label' => function (SocialIssue $socialIssue) { - return $this->translatableStringHelper->localize($socialIssue->getTitle()); + return $this->socialIssueRender->renderString($socialIssue, []); }, 'multiple' => true, 'choices' => $accompanyingPeriod->getRecursiveSocialIssues(), diff --git a/src/Bundle/ChillActivityBundle/config/services/form.yaml b/src/Bundle/ChillActivityBundle/config/services/form.yaml index 106ee5cf8..3da20cce5 100644 --- a/src/Bundle/ChillActivityBundle/config/services/form.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/form.yaml @@ -31,6 +31,7 @@ services: - "@doctrine.orm.entity_manager" - "@chill.main.helper.translatable_string" - "%chill_activity.form.time_duration%" + - '@Chill\PersonBundle\Templating\Entity\SocialIssueRender' tags: - { name: form.type, alias: chill_activitybundle_activity }