Problem/Motivation
Dropzone upload widget does not provide any information about limitations set up on configuration page. Default image field has some additional information below upload field so the user is notified about limitations.
Default image field upload widget

Current implementation of Dropzone upload widget

Proposed resolution
Implement similar functionality for Dropzone Widget, all the data is accessible in DropzoneJsEbWidget::getForm method in configuration of the widget, a form element that will show them is missing.

Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
apugacescu commentedComment #3
zerolab commentedUse array shorthand
['@size' => ...]Use array shorthand
['@extensions' => ...]Would be cleaner not to add this if
$descriptionsis empty.Comment #4
apugacescu commented@zerolab Thanks for noticing this, it was inspired from field module, I've updated the patch.
Comment #5
apugacescu commentedComment #6
primsi commentedThanks for this improvement. Would it make sense to add that in the dropzone element in dictDefaultMessage? This would then apply to all widgets and it might be a bit better from UX perspective.
Comment #7
primsi commentedPutting this to Needs work. IMHO that's the right approach, happy to hear other arguments though.
Comment #8
apugacescu commented@Primsi the initial thought was to have a consistent state with image field but use of dictDefaultMessage makes sense.
Comment #9
apugacescu commentedComment #10
a.milkovskyTried #8 - the
tags are rendered as a plain text. Adding a new patch
Comment #11
a.milkovskyComment #12
imclean commentedHard coding these in the template doesn't seem flexible enough to me. Could it be abstracted in some way so it's easy to extend in future or by other modules? Something like:
Comment #13
a.milkovsky@imclean anybody can easily extend any template by simply copying it in the theme folder.
Comment #14
imclean commented@a.milkovsky, true but there's less to modify if we don't have to update the template each time. I guess I was thinking longer term it could be good to extract any extra field information provided by any modules (e.g. base file field settings) from the context and automatically display them with no modifications to DropzoneJS.
Comment #15
roshkovanv commentedAdded fields where description text can be adjusted
Comment #17
imclean commentedAs an example of what I mean in #14, say you've installed a module which adds certain specific information. You then want to install another module which can also add some of its own information. How could either module modify the template so the data from both modules is displayed?
There can be only one template file used. If the data can be added in a hook somewhere then the information from both modules could easily be displayed without interfering with the other.
Comment #18
a.milkovsky@imclean, I agree. Makes sense. Could you provide a patch? The idea of #15 looks good as well.
Comment #19
vitalym commentedAdded missing schema changes for the description configs from #15. Also re-lolled the patch for the latest version - it should fix failing tests as well.
Comment #21
vitalym commentedOops, forgot to adjust the test form. Here is new patch.
Comment #22
chuyenlv commentedHere is new patch for version 8.x-2.1. I recreate from #21.
Comment #23
mitchel432 commentedHere is the new patch for version 8.x-2.3. I recreated from #22.
Comment #25
edysmpreroll
Comment #27
edysmpGetting `Maximum size of files: 0 bytes`
Fixing this by checking if the field has a max_filesize setting set. fallback to the environment value set in the base plugin.
Comment #29
heddnComment #30
heddnNeeded a re-roll.
Comment #31
hieuntnguyen commentedComment #32
hieuntnguyen commentedComment #33
hieuntnguyen commentedComment #34
tim-diels@hieuntnguyen, could you please elaborate why you uploaded 3 patches and what is different with #30?
Comment #35
heddnPatch in #30 still applies just fine. I'm hiding 31-33.
Comment #36
tim-dielsThanks @heddn, we're using patch from #30 and works as expected and is a really nice addition.
Setting version to 2.X-dev as this only applies on latest dev. Let's hope this is added quickly.
Comment #38
tim-dielsThe patch needs work for coding standards and the dependency for the module token is missing in the test module.
Comment #39
heddnRe-roll of #30.
Comment #41
chuyenlv commentedRe-roll of #39
Comment #42
heddnA little bit of a safer approach since render element is used in several places.
Comment #43
tim-dielsLooks good, but will need config schema update as this prints out an error when validating with Config Inspector.
Comment #44
tim-dielsApologies, looks good for the schema part.
Comment #45
tim-dielsRe-roll of #42
Comment #46
tim-dielsIn our eyes this is an important improvement to the module. We would love to see this committed. What can be done to get this committed?
Comment #47
pasha3371 commentedUpdated patch for D11 format_size() deprecation - the only difference in this patch and #45 is the inclusion of:
use Drupal\Core\StringTranslation\ByteSizeMarkup;
&
$replacements[$original] = ByteSizeMarkup::create(Bytes::toNumber($data['max_filesize']));
Comment #48
mitchel432 commentedIt appears that patch #47 missed a few files, but it does resolve the D11 issue.
Comment #50
tim-dielsThanks for the updated patch. I added this as a MR for a start point.
But we should build in the BC as this module still supports ^9.3 and ^10 and the new method only exist from 10.2 and upwards, see https://www.drupal.org/node/2999981
Please work in the MR from now on.
Comment #51
tim-dielsComment #52
tim-dielsMade patch from #45 visible again as that is the one supporting untill D11.