I have a multi select field using check boxes and I have themed it to have an icon to the left of each item. The problem is that if only one item is selected there is no wrapper with the field-item class, and therefore the icon does not display. So I need to add the field-item wrapper always instead of only when there is more than one item. I put this as a bug report because I think it should be the default format, but if there is an override I could do somewhere in my theme that would work as well. Thanks.

CommentFileSizeAuthor
#7 cck-752268-6.patch567 bytesshaneonabike

Comments

codigovision’s picture

Project: Content Construction Kit (CCK) » Views (for Drupal 7)
Version: 6.x-2.6 » 6.x-2.7
Component: Views Integration » page displays
Category: bug » support

moving to views, if this is not posted in the correct place, please direct me in the right direction to get this issue resolved, thank you.

merlinofchaos’s picture

Project: Views (for Drupal 7) » Content Construction Kit (CCK)
Version: 6.x-2.7 » 6.x-2.6
Component: page displays » General
Priority: Critical » Normal

1) Support requests should not be marked critical
2) How is Views even involved here?

codigovision’s picture

Sorry, I had this as a CCK Issue, but no responses, and it just occurred to me that the problem is only when the field is displayed in a view. I just need to add a wrapper for the item when there is only one.

codigovision’s picture

Category: support » feature
Status: Active » Needs work

found the issue in cck/includes/views/handlers/content_handler_field_multiple.inc there is an if statement when rendering the field, and if there is only one value it does not get themed. I changed it to this for now, just to get it to work, but I realise it is a poor hack:

        if (count($rendered) > 1) {
          // TODO: could we use generic field display ?
          return theme('content_view_multiple_field', $rendered, $field, $values);
        }
        elseif ($rendered) {
        // return $rendered[0];
	  return theme('content_view_multiple_field', $rendered, $field, $values);
        }
      }

Personally, as someone who creates and themes a lot of Drupal sites, I think it should always render themed.
Any thoughts on this? Is this something that can be updated to head? If not how can i write this into my theme?

Thank you,

www.codigovision.com

shaneonabike’s picture

I agree... and actually it makes it super hard to customise your own code to deal with this properly

shaneonabike’s picture

Version: 6.x-2.6 » 6.x-2.9
Component: General » Views Integration
Category: feature » bug

I applied the suggested workaround and it seems to have resolved the problem for me as well. I'll try and roll a patch in the next day or so here.

shaneonabike’s picture

Status: Needs work » Needs review
StatusFileSize
new567 bytes

Eeesh my bad this is over a year due :(

Please test and let me know :)

codigovision’s picture

Yeah looks like a cleaner solution. As soon as I get a chance I'll apply it and post back. Thanks!

shaneonabike’s picture

Issue summary: View changes

Can we apply this just so folks who are still using CCK-6 can have the latest changes... I can't upgrade until this is pushed.

shaneonabike’s picture

@codigo: ping?

codigovision’s picture

Hi Shane, Sorry I never posted back. I have since upgraded the project in question to Drupal 7 and haven't had an issue with this since. Not sure if this ever made it into version 6.

shaneonabike’s picture

Version: 6.x-2.9 » 6.x-2.x-dev
Status: Needs review » Reviewed & tested by the community

Still an issue but the patch is still legit!