How to use the text editor type for a translated type with EasyAdmin 2 and A2lix TranslationFormBundle

557 views Asked by At

In the example below, the SetTranslation entity has a field introduction (type="text") which is displayed in forms using a simple textarea.

How to configure a text field to use the text_editor (only known by EasyAdmin) with a translated field ?

Here is the EasyAdmin 2 config for the Set entiy:

easy_admin:
    entities:
        Set:
            form:
                fields:
                    - 
                        property: translations
                        type: 'A2lix\TranslationFormBundle\Form\Type\TranslationsType'
1

There are 1 answers

0
prossel On

The solution is to specify the type with the full path using the type_options and field_type properties:

easy_admin:
    entities:
        Set:
            form:
                fields:
                    - 
                        property: translations
                        label: ''
                        type: 'A2lix\TranslationFormBundle\Form\Type\TranslationsType'
                        type_options: 
                            fields:
                                introduction: 
                                    field_type: 'EasyCorp\Bundle\EasyAdminBundle\Form\Type\TextEditorType'