mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
form acc work edit: save action
This commit is contained in:
@@ -35,6 +35,7 @@ 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;
|
||||
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
||||
|
||||
class ActivityType extends AbstractType
|
||||
{
|
||||
@@ -46,6 +47,10 @@ class ActivityType extends AbstractType
|
||||
|
||||
protected TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
protected SocialIssueRender $socialIssueRender;
|
||||
|
||||
protected SocialActionRender $socialActionRender;
|
||||
|
||||
protected array $timeChoices;
|
||||
|
||||
public function __construct (
|
||||
@@ -54,7 +59,8 @@ class ActivityType extends AbstractType
|
||||
ObjectManager $om,
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
array $timeChoices,
|
||||
SocialIssueRender $socialIssueRender
|
||||
SocialIssueRender $socialIssueRender,
|
||||
SocialActionRender $socialActionRender
|
||||
) {
|
||||
if (!$tokenStorage->getToken()->getUser() instanceof User) {
|
||||
throw new \RuntimeException("you should have a valid user");
|
||||
@@ -66,6 +72,7 @@ class ActivityType extends AbstractType
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->timeChoices = $timeChoices;
|
||||
$this->socialIssueRender = $socialIssueRender;
|
||||
$this->socialActionRender = $socialActionRender;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
@@ -124,7 +131,7 @@ class ActivityType extends AbstractType
|
||||
'required' => $activityType->isRequired('socialActions'),
|
||||
'class' => SocialAction::class,
|
||||
'choice_label' => function (SocialAction $socialAction) {
|
||||
return $this->translatableStringHelper->localize($socialAction->getTitle());
|
||||
return $this->socialActionRender->renderString($socialAction, []);
|
||||
},
|
||||
'multiple' => true,
|
||||
'choices' => $accompanyingPeriod->getRecursiveSocialActions(),
|
||||
|
@@ -32,6 +32,7 @@ services:
|
||||
- "@chill.main.helper.translatable_string"
|
||||
- "%chill_activity.form.time_duration%"
|
||||
- '@Chill\PersonBundle\Templating\Entity\SocialIssueRender'
|
||||
- '@Chill\PersonBundle\Templating\Entity\SocialActionRender'
|
||||
tags:
|
||||
- { name: form.type, alias: chill_activitybundle_activity }
|
||||
|
||||
|
Reference in New Issue
Block a user