diff --git a/src/Bundle/ChillMainBundle/Form/LocationFormType.php b/src/Bundle/ChillMainBundle/Form/LocationFormType.php index 83d1c4242..e7f2c1d5e 100644 --- a/src/Bundle/ChillMainBundle/Form/LocationFormType.php +++ b/src/Bundle/ChillMainBundle/Form/LocationFormType.php @@ -15,15 +15,15 @@ use Symfony\Component\OptionsResolver\OptionsResolver; final class LocationFormType extends AbstractType { - // private TranslatableStringHelper $translatableStringHelper; + private TranslatableStringHelper $translatableStringHelper; - // /** - // * @param TranslatableStringHelper $translatableStringHelper - // */ - // public function __construct(TranslatableStringHelper $translatableStringHelper) - // { - // $this->translatableStringHelper = $translatableStringHelper; - // } + /** + * @param TranslatableStringHelper $translatableStringHelper + */ + public function __construct(TranslatableStringHelper $translatableStringHelper) + { + $this->translatableStringHelper = $translatableStringHelper; + } public function buildForm(FormBuilderInterface $builder, array $options) { @@ -38,8 +38,7 @@ final class LocationFormType extends AbstractType ]; }, 'choice_label' => function (EntityLocationType $entity) { - //return $this->translatableStringHelper->localize($entity->getTitle()); //TODO not working. Cannot pass smthg in the constructor - return $entity->getTitle()['fr']; + return $this->translatableStringHelper->localize($entity->getTitle()); }, ]) ->add('name', TextType::class) diff --git a/src/Bundle/ChillMainBundle/Form/UserCurrentLocationType.php b/src/Bundle/ChillMainBundle/Form/UserCurrentLocationType.php index 6d3d5f6df..97097c079 100644 --- a/src/Bundle/ChillMainBundle/Form/UserCurrentLocationType.php +++ b/src/Bundle/ChillMainBundle/Form/UserCurrentLocationType.php @@ -3,7 +3,7 @@ namespace Chill\MainBundle\Form; use Chill\MainBundle\Entity\Location; -// use Chill\MainBundle\Templating\TranslatableStringHelper; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; @@ -12,15 +12,15 @@ use Symfony\Component\Form\FormBuilderInterface; class UserCurrentLocationType extends AbstractType { - // private TranslatableStringHelper $translatableStringHelper; + private TranslatableStringHelper $translatableStringHelper; - // /** - // * @param TranslatableStringHelper $translatableStringHelper - // */ - // public function __construct(TranslatableStringHelper $translatableStringHelper) - // { - // $this->translatableStringHelper = $translatableStringHelper; - // } + /** + * @param TranslatableStringHelper $translatableStringHelper + */ + public function __construct(TranslatableStringHelper $translatableStringHelper) + { + $this->translatableStringHelper = $translatableStringHelper; + } public function buildForm(FormBuilderInterface $builder, array $options) { @@ -29,9 +29,8 @@ class UserCurrentLocationType extends AbstractType 'class' => Location::class, 'choice_label' => function (Location $entity) { return $entity->getName() ? - $entity->getLocationType()->getTitle()['fr'] . ' ' . $entity->getName() : - //$this->translatableStringHelper->localize($entity->getLocationType()->getTitle()); //TODO does not work - $entity->getLocationType()->getTitle()['fr']; + $this->translatableStringHelper->localize($entity->getLocationType()->getTitle()) . ' ' . $entity->getName() : + $this->translatableStringHelper->localize($entity->getLocationType()->getTitle()); }, ]); } diff --git a/src/Bundle/ChillMainBundle/config/services/form.yaml b/src/Bundle/ChillMainBundle/config/services/form.yaml index b20f9e226..8c741ed36 100644 --- a/src/Bundle/ChillMainBundle/config/services/form.yaml +++ b/src/Bundle/ChillMainBundle/config/services/form.yaml @@ -140,10 +140,10 @@ services: autoconfigure: true autowire: true - Chill\MainBundle\Form\Type\LocationFormType: + Chill\MainBundle\Form\LocationFormType: autowire: true autoconfigure: true - Chill\MainBundle\Form\Type\UserCurrentLocationType: + Chill\MainBundle\Form\UserCurrentLocationType: autowire: true - autoconfigure: true \ No newline at end of file + autoconfigure: true diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index 340cb0e29..a4d49403d 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -206,8 +206,7 @@ Location list: Liste des localisations Location type: Type de localisation Phonenumber1: Numéro de téléphone Phonenumber2: Autre numéro de téléphone -Configure location: Configuration des localisations -Configure location type: Configuration des types de localisations +Configure location and location type: Configuration des localisations # circles / scopes Choose the circle: Choisir le cercle