It looks like in the course of #140783: A select list without #default_value always passes form validation the <none> option in the "Link image to" display formatter setting of Image fields was lost. I presume this was being added automatically by FAPI half way through that issue but when the behavior was rolled back this none option didn't make its way back into the display formatter settings. If I read the summary properly, all I need to concern myself with is adding an #empty_option to the setting. On testing, the attached patch appears to work fine.
I didn't know if there was some standard for how these empty options should read, so I just chose the word that makes semantic sense... "This image links to nothing." reads better than "This image links to none."
This does make me wonder if any others were missed... but I suppose those would get separate issues. : )
Comment | File | Size | Author |
---|---|---|---|
#7 | select_missiong_empty-936536-7.patch | 4.47 KB | yched |
image_field_display_link_none.patch | 761 bytes | rszrama | |
Comments
Comment #1
yched CreditAttribution: yched commentedI must admit I kind of lost track on what #140783: A select list without #default_value always passes form validation does exactly. However, #934110: Regression: Installer defaults country to 'Afghanistan' not '- None -' received a similar fix and got signed off by sun, so this one should be OK.
+ bumping priority.
Comment #2
sunI just went through the originally committed patch to extract all locations that we should double-check here -- basically, all select lists that previously had a manually inserted "none" option need to set either #empty_value or #empty_option now. To use the default none option, only #empty_value should be set. Only set #empty_option, if we explicitly need a different empty option text than "- None -".
That said, I think we should go with the default #empty_option for Image field's link target select list, too.
Comment #3
rszrama CreditAttribution: rszrama commented@sun, just so I'm understanding - instead of using #empty_option we can just set #empty_value to an empty string or something? Is there any fallback to using a particular value? (A grep just turned up several variations on #empty_value in various modules.)
Comment #4
sunCorrect. If #empty_value is set, a non-required select list gets the additional empty option.
Either #empty_value or #empty_option can be set to trigger the empty option. Of course, you can also set both.
#empty_value defaults to an empty string (''), #empty_option defaults to '- None -'.
For this issue, we are only interested in select lists that
- are not #required
- and should have an empty option,
- but do not define #empty_value or #empty_option.
I think that some of the select lists I pasted above were already fixed in the follow-up patch, but we should double-check that to be sure.
Comment #5
yched CreditAttribution: yched commentedre #2 :
- hunks in field_ui.admin.inc :
Right - we need to add '#empty_value' => '' to all the ['parent_wrapper']['parent'] elements - both in field_ui_field_overview_form() and field_ui_display_overview_form().
- image.field.inc :
That looks like a missing '#empty_option' => '<' . t('no preview') . '>'
Did not look into the other hunks.
Comment #6
Dave ReidSubscribe
Comment #7
yched CreditAttribution: yched commentedLet's fix those - the ['parent_wrapper']['parent'] one on Field UI is messing with people testing fieldgroups.
Attached patch fixes all the hunks sun identified in #2.
Comment #8
effulgentsia CreditAttribution: effulgentsia commentedSubscribe.
Comment #9
effulgentsia CreditAttribution: effulgentsia commentedEh. Not really sure what the right component for this issue is, so calling it "forms system" for now.
Comment #10
webchickCommitted #7 to HEAD. That might not be everything, but it's at least better than what we have.