When uploading new files to a file field (which allows multiple values) there is no way to access original values in FileWidget::formElement()
at form rebuilding process since they are overwritten by the new ones. The problem arises when some other widget which extends file widget needs to access these original values.
In case of VisualN, file field and widget are used as a base for the VisualN file field and widget respectively. For each VisualN file delta user can choose a visualization style to be applied to the data in the uploaded file to create a visualization. Each style has its configuration which can be overridden by the one stored for the delta. If user changes the configuration and saves the entity, later the style and configuration can be changed editing the entity.
Steps to demonstrate a case when initial unchanged values are required:
- Create a content type with a VisualN file (and configure the formatter)
- Create a new node and upload a file
- Choose a style and change default configuration
- Save the node
- Open the node for edit
- Change the style to some other one
- Upload a new file
- Change the style (for the fist file) back to the initial one
So at the last step initial unchanged configuration (for the first delta) is needed though it was overridden by the new value, thus the user needs to refresh the form and reupload required files (and any other changes) if he wants the configuration for the first delta to get back to its initial values.
Comments