Yeah, this is minor, but I thought I should point it out, and see if anyone else noticed this:

I have a node type with an Unlimited value multigroup in it.

Within the multigroup:

- Nodereference field (1 value)
- Textfield A
- Textfield B
- Filefield/Image Upload (1 value)

In the node edit form: all the other field widgets display their corresponding labels, EXCEPT the image upload widget.

I added descriptive help text for the widget, and that displays just fine. I changed the widget label from "Image" to something else. Still doesn't show.

I printed the $form variable using Devel. The label value is there ($form['group_mygroupname'][0]['field_myimagefield']['#title'], $form['group_mygroupname'][1]['field_myimagefield']['#title'], etc). It's just not rendering in the multigroup area. Imagefield widgets outside of multigroups display widget label properly.

Yes, a tiny thing, but wanted to point it out.

Comments

markus_petrux’s picture

Project: Content Construction Kit (CCK) » FileField
Component: content_multigroup.module » Code

I think this could be fixed in filefield module itself.

CCK places the $field array in the form, in $form['#field_info'][$field_name], to allow other modules alter the field structure for the purposes of building the form, without the need to get the data using conetnt_fields(). That array in the form is modified by the multigroup module to alter the multiple attribute so that the widget of a multiple value field is rendered as a single widget for each subgroup of fields in the multigroup.

Sorry, I do not have the tools now to create a formal patch, but the change is pretty simple. You need to edit filefield_widget.inc and apply the following patch:

   $item = $element['#value'];
   $field_name = $element['#field_name'];
   $delta = $element['#delta'];
   $element['#theme'] = 'filefield_widget_item';

-  $field = content_fields($element['#field_name'], $element['#type_name']);
+  $field = $form['#field_info'][$field_name];

   // Title is not necessary for each individual field.
   if ($field['multiple'] > 0) {
     unset($element['#title']);
   }

Et voilà, a FileField within the context of a multigroup defined to allow multiple values will now render the widget label.

quicksketch’s picture

Status: Active » Needs review

Thanks, excellent advice markus_petrux! I'll have a look at this next time I'm working on FileField.

ccshannon’s picture

Yes, thanks! I'll give this a whirl very soon.

BTW, markus, thanks for all the work on improving the nodereference and multigroup functionality. Much appreciated!

aaront’s picture

I was having this exact problem -- had a filefield in a multigroup and the label wasn't showing up. Tried markus' one-line change and it shows up perfectly now. Thank you so much! Just a little thing but an important thing for me.

quicksketch’s picture

Status: Needs review » Fixed

I've committed the fix suggested by markus_petrux in #1.

Status: Fixed » Closed (fixed)

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