Problem/Motivation
The form to create bundles would gain a lot in UX if these 2 points were avoided/resolved:
1- Users currently have to create a bundle, then create a field and then come back to the bundle form to set the source field.
2- Users currently have to select the option "gather exif" data, save the form, and then reload the bundle edit form to have the actual exif mapping fields available.
I understand that the point #1 is being solved in #2625854: Provide default source_field when creating new media entity bundles, so let's leave it out of this issue.
For the point in #2, the ideal scenario would be to rebuild the form container by ajax with the exif fields as soon as the user selects this option in the dropdown.
Proposed resolution
Option A: Update the form using ajax to present all fields available to mapping without leaving the page.
Option B: Improve the description of the "Whether to gather exif data" option, indicating that the user needs to save and reload the page in order to have these fields available.
Remaining tasks
- Decide which solution is best
- Implement it
Comments
Comment #2
marcoscanoPatch attached if we decide to go for option B. The text being changed is:
t('Gather exif data using exif_read_data().')into
t('Gather exif data using exif_read_data(). After choosing this option, you need to save and reload this page in order to have the additional fields available on the mapping section below.')Comment #3
slashrsm commentedCould we rather reload the form through AJAX when the value changes?
Another improvement came to my mind when I was looking at this patch. We disable the dropdown if
exif_read_data()is missing. I think that it would be nice to add an explanation message in this case.Comment #4
shreya shetty commentedComment #5
shreya shetty commentedI have provided the functionality which is mentioned in this issue . Please review the patch
Comment #8
shreya shetty commentedComment #9
shreya shetty commentedComment #10
slashrsm commentedGeneral approach of the patch looks good. There are few coding/documentation standards that need to be fixed. Running CodeSniffer on it would help.
Based on the nature of the test fails I suspect that the upload field on the entity form is missing or not not being loaded correctly. I didn't run then so I might be wrong though.
Comment #11
shreya shetty commentedThank You for the review . I think we need to update the test for this . And fixed all the documentation error pointed all by code sniffer for this particular file.
Comment #14
shreya shetty commentedComment #15
slashrsm commentedComment #16
marcoscanoDon't know why the testbot is failing, I have green in local so it is difficult to find the problem...
In any case:
If we are reusing the
ajaxTypeProviderData, there is no need to redeclare it inside the plugin, isn't it?The patch attached works as well, without duplicating it inside the image plugin. (Actually the added
ajaxTypeProviderDatathere wasn't being called at all)Comment #17
secretsayan commentedYes exactly @marcoscano. The function ajaxTypeProviderData wasn't being called at all. I was also a bit confused about the test bot. Anyways , I can confirm this patch is working.
Comment #19
slashrsm commentedCommitted. Thanks!