The File widget does not require that a file be uploaded. You can save it without any content at all (no title, no text, no file). Same for the Image, Map, Links, Spotlight, Table, Text, and Video widgets.
This is in contrast to the Content Item widget, which requires a content item. Content List and Submenu have settings which will always result in something being added. Spotlight will require an image if you put in a title, but you can still save it without any content at all.
Should all widgets require content to be added before they can be saved?
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | panopoly_test-required-fields-2505357-9.patch | 2.63 KB | cboyden |
| #8 | panopoly_widgets-required-2505357-8.patch | 3.15 KB | cboyden |
| #6 | panopoly_widgets-required-2505357-6.patch | 3.12 KB | dsnopek |
Comments
Comment #1
cboyden commentedComment #2
dsnopekYeah, I think we should make content required on all the widgets! There's no valid use case for a File widget without a File, which means you'd only do it by mistake, and a helpful message would be better UX than an inexplicably empty widget. :-)
Comment #3
mazze commentedPlease make sure that my workaround for multilingual FPP does not get affected;-) https://www.drupal.org/node/2466969
Comment #4
dsnopek@mazze: Great point! Let's postpone this on fixing #2466969: FPP preview not updated when pane contains multilingual field(s)
Comment #5
dsnopekThinking about this now, I'm not sure it makes sense to keep this postponed. It's really just a matter of marking the most important field on each widget as required. That shouldn't make things any worse for multilingual - some widgets have required fields already. So, unpostponing this!
Comment #6
dsnopekHere's a patch to implement!
EDIT: Here's a Travis build: https://travis-ci.org/panopoly/panopoly/builds/353501437
Comment #7
dsnopekThis needs updates to the live preview tests because now some fail due to required fields not being filled! We can probably just reorder when different parts are filled out so that the required ones are done first. Or, actually, we could test that the required message appears too, which would be good if we aren't already testing that
Comment #8
cboyden commentedHere's a quick reroll to increment the update hook number.
Comment #9
cboyden commentedWork-in-progress patch for panopoly_test that checks for the field required message and then fills in the required fields. Also updates to the new field naming convention for Tablefield.
Comment #10
cboyden commentedHere's the Travis build with the two patches above and with the one in #2952671: File and Image widgets show PHP notices when underlying file has been deleted. The live preview test that checks for pane styles is failing consistently, but I don't think that is related to any of these patches.
https://travis-ci.org/cboyden/panopoly/builds/357617831
Comment #12
dsnopekI think the failure is related to #2954647: Linkit and live preview with panes style tests failing on Travis and can be fixed as part of that issue
I read through the tests and they seem correct! I didn't retest them, but the build you did looks good, so... merged!