Use SocialIssueRenderer->renderString for displaying socialIssues

This commit is contained in:
Marc Ducobu 2021-06-04 15:04:36 +02:00
parent 39dca2a9ca
commit e52c94aabd
2 changed files with 6 additions and 2 deletions

View File

@ -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(),

View File

@ -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 }