I've tried to get themed output of my (imagefield) field called 'images' as usual by making a file 'field-field_images.tpl.php' in my theme's dir. All of my fields are themed by this way with no problems but imagefield. By adding 'print $field['type'];' to 'phptemplate_field()' function in my template.php I've got all fields listed but imagefield. Did I something wrong or is there a bug or is there an another way for this type of field to get themed?

CommentFileSizeAuthor
#9 73980.patch.txt1.04 KBdopry

Comments

tema’s picture

however it's possible to theme the entire content type (via contemplate.module in my example) with imagefield as well. I'm totally distracted :-(

stanbroughl’s picture

you can use the content template module (contemplate) to theme your out put - its specifically been designed to theme your cck output. I'm using it on the site i'm developing and its working great.

Lucy

tema’s picture

My previous followup was posted just after checking this in contemplate.module, but the problem is exactly that imagefield fields not being passed through theme_field().

The advantage of CCK is ability to reuse typical content fields. In this case making templates for such fields is better than making it for each of content types (more Copy/Paste, less bug control). When a new content type is added there's no more work for theming if it reuse already themed fields. Moreover it's possible to control the order of fields in node with 'weight' value.

dopry’s picture

Status: Active » Fixed

It should passed through content_format which handles this now.

Anonymous’s picture

Status: Fixed » Closed (fixed)
magnestyuk’s picture

Opening this again. Changing one line in imagefield.module makes it themeable in a field-field_xxx.tpl.php file.

Find this line in the imagefield_field function

      $output = '<div class="'. $field['field_name'] .'">'. $view .'</div>';

and change it to

      return theme('field', $node, $field, $node_field, $teaser, $page);
magnestyuk’s picture

Status: Closed (fixed) » Active

forgot to change status...

dopry’s picture

I'd strongly prefer you open new issues instead of opening long since closed issues.
that aside please submit you patch as a patch.
see http://www.drupal.org/diffandpatch

dopry’s picture

Status: Active » Needs review
StatusFileSize
new1.04 KB

Here is an update patch that uses theme('field'... I think that code if left over from before theme_field existed, or I had some bone headed reason for not using it. please test if its kosher I'll probably make it a 4.7.2 series since the output changes would probably break live sites....

joshk’s picture

++

Works for me. It seems to confuse imagecache a little (although that wasn't "working" right for me before), Overall this is a great improvement. No more losing images when previwing!

dopry’s picture

Status: Needs review » Fixed

committed to DRUPAL-4-7 and HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)