I just starting using pollfield in a D6 site to enable polls in our forums. I noticed that the cck label for the field was always displaying even when no choices were available. I tracked this down content_preprocess_content_field in content.module was thinking the field was not empty because item['view'] had the value '

....

'

This I tracked down to the various functions like theme_pollfield_formatter_default(). These all follow the same format and use $show_form to control whether to return the html or nothing. I don't see any way that $show_form can ever be false so I fixed that up. I made the value initialized to false and then set it to true whenever we are processing a non-empty choice:

if (!empty($choices)){
foreach ($choices as $delta => $choice) {

if (!empty($choice['choice'])){
$show_form = true;
....

So I'm attaching a patch file that fixes all of these functions as well as couple of typos I came across while debugging. The patch file is bigger than necessary because I ended up reformatting some code so that I could read it better.

CommentFileSizeAuthor
pollfield-empty.patch16.51 KBbkat

Comments

mario_prkos’s picture

Thank you for your contribution. I will announce about your your patch on release notes for recommended version and I included it in dev version. Also, I will include this patch in next release after I collect more feedback, bugs and issues about module from users.
Any feedback is welcome.

Best regards,

dddave’s picture

Status: Active » Fixed

This seems to be fixed, isn't it? Tested a bit and the field label now only appears when there is some content.

bryan kennedy’s picture

Yes, that patch was rolled into the latest .dev and the 6.x-1.10-BETA1 version.

Status: Fixed » Closed (fixed)

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