I have a view with the "image attach" as field. No relation, no filter and Nid as argument. The view should show all attached images from the node where the node id was given in the argument i believe. When multiple images are attached, it only shows the last attached image.

I also use the image update module, so each attached image is a node. I don't know if that matters.

Comments

joachim’s picture

Yes, I found this the other day :(

joachim’s picture

I'm trying to figure out whether best to reuse theme_image_attach_node_attached() or put the theming in a separate function.

Opinions?

jan_v’s picture

I don't know. What exactly are the pros and contras for the existing function or a new separate one?

joachim’s picture

Assigned: jan_v » Unassigned
Status: Active » Needs review
StatusFileSize
new2.07 KB

I've had a ponder and I am restructuring (again!) the theming functions.

Here is a patch which depends on the new one at #412288: restructure theme_image_attach_body/teaser .

Status: Needs review » Needs work

The last submitted patch, 825130.image_attach.views-handler-multiple-images.patch, failed testing.

jan_v’s picture

I've tried to apply these patches, but with little success. So i used a workaround.
Instead of relying on a view to display all the attached images, i've used a simple view of image nodes with nid(s) as argument. These nids come from $vars['iids'] in the theme preprocess functions.

This worked fine for me.

joachim’s picture

Status: Needs work » Needs review

> I've tried to apply these patches, but with little success

Can you explain what went wrong please?

The testbot seems to be having issues... I'd ignore its output on that one.

jan_v’s picture

Status: Needs review » Needs work

You've mentioned in a previous comment that this is a patch which depends on the new one at #412288: restructure theme_image_attach_body/teaser.

So i first tried to install that one (in post #20) , and after that patch was applied, i got an error saying "Invalid argument supplied in for each".
It was the foreach on line number 203 from that patch [foreach ($image_nodes as $image) { ... ] .

I hope this is usefull for you.

joachim’s picture

Try clearing your theme cache. Or in fact all caches.

jan_v’s picture

I've done that. The browser cache, drupal's cache and views's cache. Or did i miss one?
It was still giving me the same error. But i'm going to settle with the workaround. There's still a lot of work waiting.

joachim’s picture

Status: Needs work » Needs review
Issue tags: -views, -image attach, -last image

I've committed that other patch, so:

#4: 825130.image_attach.views-handler-multiple-images.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +views, +image attach, +last image

The last submitted patch, 825130.image_attach.views-handler-multiple-images.patch, failed testing.

joachim’s picture

Status: Needs work » Fixed

The testing bot is clearly being wacky...

This all looks fine for me. Committing this. Please try the dev version which will shortly be updated with this change.

#825130 by joachim: Fixed image attach Views field showing only last attached image per node.

Status: Fixed » Closed (fixed)
Issue tags: -views, -image attach, -last image

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