a2lix / TranslationFormBundle

Ease translations with some dedicated Symfony form types
https://a2lix.fr/bundles/translation-form
MIT License
330 stars 140 forks source link

Using addModelTransformer and createNamedBuilder #347

Open amsouissi opened 4 years ago

amsouissi commented 4 years ago

Hello,

I'am using a2lix/TranslationFormBundle with KnpLabs\DoctrineBehaviors. I added translations field to my form : $builder->add('translations', TranslationsType::class, [ 'fields' => [ 'content' => [ 'field_type' => TextareaType::class, 'label' => 'admin.form.label.content', 'required' => true, ], ] ]);

Before using a2lix/TranslationFormBundle , I have :

subject field should be translated.

How can I use addModelTransformer and createNamedBuilder with translated fields ?

Thanks.

tchapi commented 2 years ago

Hi @amsouissi

The content field is now a child of translations, so something along $builder->get('translations')->get('content') (not tested) ?