-
Notifications
You must be signed in to change notification settings - Fork 77
Description
| Q | A |
|---|---|
| Bug? | no |
| New Feature? | yes |
| Bundle Version | 2.5.4 |
| Sulu Version | 2.5.20 |
| Browser Version | n/a |
Actual Behavior
There is the field type AttachmentFieldType, that is the only way to use file input elements in the SuluFormBundle because of the processing of uploaded files is tied to the field type name "attachment" (see
SuluFormBundle/Entity/Dynamic.php
Line 21 in 12d2df1
| public const TYPE_ATTACHMENT = 'attachment'; |
AttachmentFieldType has the possiblity to restrict uploads to image, video and audio file types, but no other file type restrictions.
Expected Behavior
- Possibility of adding custom upload/attachment field types (e.g. for different behavior/processing of uploaded files in form events)
- Extending of the AttachmentFieldType by custom settings (e.g. other file type restrictions)
Steps to Reproduce
Is an current try to extend the AttachmentFieldType for using custom file type restriction, e.g.:
<properties xmlns="http://schemas.sulu.io/template/template"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/properties-1.0.xsd">
<xi:include href="../../vendor/sulu/form-bundle/Resources/config/form-fields/default_field.xml" xpointer="xmlns(sulu=http://schemas.sulu.io/template/template)
xpointer(//sulu:property)"/>
<property name="options/type" type="select" colspan="6">
<meta>
<title>sulu_form.attachment_restrict</title>
<info_text>sulu_form.attachment_restrict.hint</info_text>
</meta>
<params>
<param name="values" type="collection">
<param name="image">
<meta>
<title>sulu_form.attachment.image</title>
</meta>
</param>
<param name="audio">
<meta>
<title>sulu_form.attachment.audio</title>
</meta>
</param>
<param name="video">
<meta>
<title>sulu_form.attachment.video</title>
</meta>
</param>
<param name="document">
<meta>
<title>form_dynamic.attachment.document</title>
</meta>
</param>
</param>
</params>
</property>
<property name="options/max" type="number" colspan="6">
<meta>
<title>sulu_form.attachment_max</title>
</meta>
</property>
</properties>
I saw the only way in using service decoration or compiler pass.
Possible Solutions
Like in my other issue (#397) a possible solution could be the use of the FormFieldTypeConfiguration group, because it seems to be not used anywhere at the time.