As with all subclasses, the actual initialization is done in the initialize() function, not in the constructor, to allow for error handling.
This widget supports the images type or any subtype thereof.
All processing is done during the on_submit handlers, enforcing immediate update of the associated storage objects. No other solution is possible, since we need to transfer uploaded files somehow through multiple requests.
The type will show a tabular view of all uploaded images. Existing images have an editable title and can be deleted or replaced. A single new upload line is displayed always. There is no preview, but there is a download link.
Available configuration options:
Implementation notes:
The construction of the widget is relatively complex, it relies on a combination of static and input elements to do its work. It should be fairly customizable using CSS.
All elements will be added in a group using the groupname[elementname] Feature of QF. Static elements are all prefixed s_, f.x. s_header. The actual elements use an e_, f.x. e_new_title. All elements in the new upload row append a new_ to this prefix as seen in the last example. Finally, elements referencing existing attachments append an exist_{$identifier}_ to the prefix, f.x. e_exist_{$identifier}_title.
The table gets the Name of the field as id and midcom_helper_datamanager2_widget_images as class. Each column also gets its own CSS class: filename, title, file, upload and delete. An additional class is assigned depending whether this is a row for an existing item (exist) or a new one (new). So a full class for the new filename element would be "new filename". Note, that the classes are assigned to both the td and input elements. The th elements do not have any additional class
The auto-generated image identifiers from the images base type are used.
package | midcom.helper.datamanager2 |
---|
boolean
Indicating SuccessThis includes title updates (all are done regardless of actual updates).
string
The identifier of the image to add.boolean
Set this to true, if you want to skip all elements which cannot be frozen.boolean
Set this to true, if you want to skip all elements which cannot be frozen.boolean
Set this to true, if you want to skip all elements which cannot be frozen.boolean
Set this to true, if you want to skip all elements which cannot be frozen.Calls for images which are not listed in the form, will be silently ignored. This may happen, for example, if two users edit the same object simultaneoulsy, or during addition of new elements.
string
The attachment identifier to check for updates.array
The values associated with our element group (not the full submit value list).If yes, it is processed.
array
The values associated with our element group (not the full submit value list).It populates the _elements member, which is initialized with a new, empty array during startup.
boolean
Set this to true, if you want to skip all elements which cannot be frozen.