Previously using alpha5, upgraded to alpha6. Nodes where I used Contemplate stopped displaying images for both teasers and full nodes. I previously printed the images using $node->content['image_attach']['#value'] in the Contemplate template. I looked at the Contemplate variables, and they don't seem to be what they were before. Relevant teaser variables are now:

$node->content['image_attach'] (array)

    $node->content['image_attach'][10] (array)

        $node->content['image_attach'][10]['#value']
            <div style="width: 192px" class="image-attach-teaser"><a href="/img/image"><img src="http://site.com/file/images/image-thumbnail.png" alt="Image" title="Image" class="image image-thumbnail " width="192" height="149" /></a></div> 
        $node->content['image_attach'][10]['#title'] (NULL)
        $node->content['image_attach'][10]['#description'] (NULL)
        $node->content['image_attach'][10]['#printed'] (boolean)
            TRUE 

    $node->content['image_attach']['#weight'] (integer)
        0 
    $node->content['image_attach']['#title'] (NULL)
    $node->content['image_attach']['#description'] (NULL)
    $node->content['image_attach']['#children']
        <div style="width: 192px" class="image-attach-teaser"><a href="/img/image"><img src="http://site.com/file/images/image-thumbnail.png" alt="Image" title="Image" class="image image-thumbnail " width="192" height="149" /></a></div> 
    $node->content['image_attach']['#printed'] (boolean)
        TRUE 

So for teasers if I changed my template code to $node->content['image_attach']['#children'] I could again display images (in teasers).

However for full nodes the "Body Template" variables now appear as:

$node->content['image_attach'] (array)

    $node->content['image_attach']['#value']
        <div class="all-attached-images"></div> 
    $node->content['image_attach']['#weight'] (integer)
        0 
    $node->content['image_attach']['#title'] (NULL)
    $node->content['image_attach']['#description'] (NULL)
    $node->content['image_attach']['#printed'] (boolean)
        TRUE 

There's nowhere else in the body variables shown by Contemplate that I find the same image display snippet that appears in the teaser variables. So it seems I can't access the attached images at all for full node view through Contemplate with alpha6.

Seems like an unplanned breakage? Should what I was doing with Contemplate still be possible?

Comments

joachim’s picture

Since image attach is now more than one image, $node->content['image_attach'] is probably now an array.
What's the 10 bit come from?

sea_lmm’s picture

I dug around a bit more, the 10 must be the image id (the node id of the attached image). The node had only one image attached.

But I think I resolved my immediate issue, after your reply I dug around further and realized that I had overridden image_attach_body in template.php and in alpha6 it seems like the function has changed a little (takes two arguments, not one). So I removed my old function, copied the new from image_attach.module, and my nodes are displaying the attached image againas they were before. I forgot I had overridden it (I wanted to remove the link from the attached images on full nodes), my apologies for not catching that before.

It still seemed to me the expected behavior would be that the same structure is present in both the teaser and in the full node - I think that was the case with what Contemplate displayed with alpha5. At this point i get my desired results using $node->content['image_attach']['#children'] for the teaser and $node->content['image_attach']['#value'] for the full node. It it helps, Contemplate shows this for the full node variables now, which still seems quite different from the teaser variables for the same node:

$node->content['image_attach'] (array)

    $node->content['image_attach']['#value']
        <div class="all-attached-images"><div style="width: 384px" class="image-attach-body"><img src="http://site.com/file/images/image.png" alt="Image" title="Image" class="image image-_original " width="384" height="297" /></div> </div> 
    $node->content['image_attach']['#weight'] (integer)
        0 
    $node->content['image_attach']['#title'] (NULL)
    $node->content['image_attach']['#description'] (NULL)
    $node->content['image_attach']['#printed'] (boolean)
        TRUE 

Aside - while doing that I noticed that in alpha6, the image teaser is now linking the attached image to the image node (node/$iid) - it used to link to the node itself, which seems more logical to me. To clarify - in alpha6 it seems both the teaser and the full node will link the attached image to the image node. It is easy to override this as well, but is that intentional?

sun’s picture

in alpha6, the image teaser is now linking the attached image to the image node (node/$iid) - it used to link to the node itself, which seems more logical to me. To clarify - in alpha6 it seems both the teaser and the full node will link the attached image to the image node

This indeed sounds odd - though I didn't verify whether it's actually true. But if it is, we should fix it.