Comments

drewish’s picture

i'm all in favor of this feature. i've been after_building this out... that said i'd like to change description_visibility => show_description.

amitaibu’s picture

StatusFileSize
new2.4 KB

changed description_visibility => show_description

amitaibu’s picture

StatusFileSize
new2.39 KB

Changed also title of form field.

webchick’s picture

Status: Needs review » Needs work

+1 for this. No longer applies. Looking into it...

webchick’s picture

Status: Needs work » Needs review
StatusFileSize
new2.29 KB

Re-roll. Patch is the same except I changed the field description from:

When enabled a description field will be visible and users may enter a description about the uploaded file.

to:

When enabled, will display a text field where users may enter a description about the uploaded file.

Now, to test it. ;)

webchick’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new70.24 KB

I tested with an ImageField, with the checkbox both on and off. Confirms that this patch solves the problem.

The UI for the field configuration a little funny. I've uploaded a screenshot. I missed this the first time and thought the patch wasn't working because it didn't have a Show description: above it. OTOH, it's a single checkbox, and the "Required" single checkbox at the top doesn't have a description either, so adding one would be inconsistent. I thought about moving it further up in the form, but "Default list value" and "How should the list value be handled?" are required, so it makes sense that they appear first in the list.

I'd be for committing this patch, and then making a follow-up issue for "Make the field settings UI a bit easier to use" Maybe one of the things we could deal with there is the awkward "?:" at the end of "How should the list value be handled?" :)

drewish’s picture

Status: Reviewed & tested by the community » Needs work

I'd like to see this as radio buttons to follow the existing pattern since they allow for clearer labels. checkboxes always require much more explanation.

webchick’s picture

Assigned: Unassigned » webchick

Ok, one moment...

webchick’s picture

Status: Needs work » Needs review
StatusFileSize
new3.3 KB

Ok this patch has a little bit more changed than the last one. Allow me to explain:

I started out by copying the same isset($foo) ? $foo : 0 logic from the other two fields. However, when I tested it, I noticed that this is setting all of these fields to have nothing selected by default. That's annoying. It happens because these fields are instantiated somewhere with a value of '' (empty string) so they are in fact set, even though they are invalid choices.

So I changed the logic on each one to instead be empty($foo) ? 0 : $foo which by random sampling of people in #drupal was easier to grok than the inverse.

Patch for your review. :)

drewish’s picture

Status: Needs review » Fixed
StatusFileSize
new3.37 KB

looks good to me but it seems like the default should be to show descriptions to preserve the current behavior.

committed the attached to HEAD.

webchick’s picture

Yay! Thanks, drewish! :)

amitaibu@drupal.org’s picture

thanks guys and girls :)

webernet’s picture

Status: Fixed » Needs work

Um...

empty(0) = TRUE, but disabled = '0'

Which means that the checking for empty() rather than isset() is wrong.

Marked #297934: Hide Description settings error. as duplicate.

drewish’s picture

Status: Needs work » Fixed
StatusFileSize
new2 KB

the problem is that it does get set to ""... so isset() doesn't work quite right either. looks like cck is always providing an empty value. committed the attached patch which checks for the empty string.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.