helios-ag / FMElfinderBundle

:file_folder: ElFinderBundle provides ElFinder integration with TinyMCE, CKEditor, Summernote editors
MIT License
275 stars 128 forks source link

Easyadmin CollectionField not working #457

Closed e1sep0 closed 2 years ago

e1sep0 commented 2 years ago

Hello, in Easyadmin it doesn`t work(( Easyadmin 3.1 "helios-ag/fm-elfinder-bundle": "^10.1",

In Easyadmin:

return 
[
Field::new('cover', 'Обложка')->setFormType(ElFinderType::class)
                ->setFormTypeOptions(
                    [
                        'instance' => 'image_form',
                        'attr' => ['class' => 'col-6'],
                    ]
                )
                ->hideOnIndex(),   // This ELFinder works perfectly
            CollectionField::new('photos', 'Фотографии')
            ->setEntryType(PhotoType::class)
];

PhotoType:

public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('path', ElFinderType::class, [
                'instance' => 'image_form',
                'enable' => true
            ])
            ->add('translations', TranslationsType::class, [
                'fields' => [
                    'description' => [
                        'field_type' => CKEditorType::class,
                        'label' => 'Описание',
                    ],
                ],
            ]);
    }

Neither ELFinder, nor CKEditor in PhotoType doesn`t work(

Originally posted by @e1sep0 in https://github.com/helios-ag/FMElfinderBundle/issues/310#issuecomment-920663352

e1sep0 commented 2 years ago

But in edit mode, if i add one file, it works 2021-09-16_10-44

e1sep0 commented 2 years ago

I decided problem editing elfinder_widget.html.twig this way:

live('click', '[data-type="elfinder-input-field"]', function (event) {
                var id = $(this).attr('id');
                var childWin = window.open("{{path('elfinder', {'instance': instance, 'homeFolder': homeFolder })}}?id="+id, "popupWindow", "height=450, width=900");
            });
helios-ag commented 2 years ago

hi @e1sep0 thanks for sharing your solution