Skip to content

Commit 17ec22b

Browse files
committed
Uopdate readme
1 parent 0f34aae commit 17ec22b

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
custom: ["https://www.paypal.me/heliosag", helios]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Recommended bundles to use with:
4343
- [Elfinder Form Type](/docs/elfinder-form-type.md)
4444
- [Configuration](/docs/elfinder-form-type.md#configuration)
4545
- [EasyAdmin 2.x](/docs/elfinder-form-type.md#easyadmin-2x-integration)
46+
- [EasyAdmin 3.x/4.x](/docs/elfinder-form-type.md#easyadmin-3x/4x-integration)
4647
- [CKEditor integration](/docs/ckeditor-integration.md)
4748
- [Installation](/docs/ckeditor-integration.md#step-1-installation)
4849
- [Configuration](/docs/ckeditor-integration.md#step-2-configure-ckeditor-setting-via-settingsyml-or-through-form-builder)

docs/elfinder-form-type.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,77 @@ design:
6161
- '@EasyAdmin/form/bootstrap_4.html.twig'
6262
- '@FMElfinder/Form/elfinder_widget.html.twig'
6363
```
64+
65+
## EasyAdmin 3.x/4.x integration
66+
67+
Almost same as for 2.x, but you need to add
68+
69+
```php
70+
71+
// ProjectCrudController.php
72+
// ...
73+
public function configureFields(string $pageName): iterable
74+
{
75+
// ...
76+
yield Field::new('image', 'Image')
77+
->setFormType(ElFinderType::class)
78+
->setFormTypeOptions([
79+
'instance' => 'default',
80+
'enable' => true,
81+
])
82+
->onlyOnForms()
83+
;
84+
// ...
85+
}
86+
87+
public function configureCrud(Crud $crud): Crud
88+
{
89+
return $crud
90+
// ...
91+
->addFormTheme('@FMElfinder/Form/elfinder_widget.html.twig')
92+
;
93+
}
94+
```
95+
96+
Collection field:
97+
```php
98+
return [
99+
Field::new('cover', 'Cover')->setFormType(ElFinderType::class)
100+
->setFormTypeOptions(
101+
[
102+
'instance' => 'image_form',
103+
'attr' => ['class' => 'col-6'],
104+
]
105+
)
106+
->hideOnIndex(),
107+
CollectionField::new('photos', 'Photos')
108+
->setEntryType(PhotoType::class)
109+
];
110+
```
111+
112+
```php
113+
public function buildForm(FormBuilderInterface $builder, array $options)
114+
{
115+
$builder
116+
->add('path', ElFinderType::class, [
117+
'instance' => 'image_form',
118+
'enable' => true
119+
])
120+
->add('translations', TranslationsType::class, [
121+
'fields' => [
122+
'description' => [
123+
'field_type' => CKEditorType::class,
124+
'label' => 'Description',
125+
],
126+
],
127+
]);
128+
}
129+
```
130+
131+
And override elfidner_widget.html.twig
132+
```js
133+
live('click', '[data-type="elfinder-input-field"]', function (event) {
134+
var id = $(this).attr('id');
135+
var childWin = window.open("{{path('elfinder', {'instance': instance, 'homeFolder': homeFolder })}}?id="+id, "popupWindow", "height=450, width=900");
136+
});
137+
```

0 commit comments

Comments
 (0)