modmore / ClientConfig

ClientConfig is a MODX Revolution Extra to allow clients to maintain settings in a user friendly way.
https://docs.modmore.com/en/Open_Source/ClientConfig/index.html
MIT License
29 stars 27 forks source link

Correctly populate file-type fields on context change #155

Closed jcdm closed 5 years ago

jcdm commented 6 years ago

Add additional values to the array sent back for file & image type fields only so they populate the fields correctly on context change.

What does it do ?

Checks if a field type is an image or file and sets two additional values in the returned JSON so that form.setValues() can do its job properly.

Why is it needed ?

These fields weren't being repopulated on context change which was leading to oversaving of the default/global value on each save following the main page load. (Main page loads, brings default value, context change does nothing, next save overwrites context value with still-present global/default vale).

Related issue(s)/PR(s)

Let us know if this is related to any issue/pull request This should resolve #147

Mark-H commented 5 years ago

Thanks, included in 2.1