Trying to theme a multiple imagefield exposed via views, I was totally happy after finding content_view_multiple_field.tpl.php, what resolved well my needings, but omg! when there was only one image, the template was never called, so after some research I found this code (unpatched)

Correct me if I'm wrong but content_view_multiple_field.tpl.php must be called in any case in a multiple field, when it's only ONE item it keeps on being a multiple field so the code must keep on calling the same template... so the correction is clearly:

252        //if (count($rendered) > 1) {
253          // TODO: could we use generic field display ?  Answer: YESSSSS!!!!!
254          return theme('content_view_multiple_field', $rendered, $field, $values);
255        //}
256        //elseif ($rendered) {
257        //  return $rendered[0];
258        //}

Thank you very much, I'll be glad if this helps anyone...
Hwangar

Comments

matsjacobsson’s picture

It helped me... been searching for this for an hour... Thanks!! /Mats

richsky’s picture

Ouch! I'm running in the same issue. How could I test that a multiple field has only one value and where?