2

I'm new to Drupal and I'm using version 7. I have created a Banner content type, to which I have added an Image field and a Link field (using the Link module). I have allowed theupload of multiple images, and adding of multiple links in this content type.

I then used Image Link Formatter module, which adds a formatter to display an image with a link. This works fine when I add a Banner content type and preview it. However, I want this Banner to be displayed by the Views Slideshow.

Unfortunately, I can't get things to display correctly when setting up a view block. If I choose to display the content, then it renders all the banners in a single slide (as might be expected). If I select the banner image field only, and choose the Image Link Formatter, it displays the banner images but not the links. I tried adding the link field as a hidden item too, however this has no effect.

As an alternative solution, I tried following this tutorial - here, it says to use the Rewrite Results option 'Output this field as a link' for the banner image, which I did and set to the link field. This didn't work as expected either though - the mapping multiplied the amount of banners, and output each banner with each link. For example:

Banner 1 - Link 1
Banner 2 - Link 1
Banner 1 - Link 2
Banner 2 - Link 2

What am I doing wrong here with the 2 approaches I tried, and what would be the recommended way to accomplish what I require?

  • Instead of the Image Link Formatter, try outputting as a link via "Rewrite Results" - that's the way I always do it and I can't recall having a problem – Clive Oct 22 '14 at 10:46
  • @Clive thanks for the comment. I did also follow the tutorial I linked to in my question, which I believe advises this method - but got the unexpected results above. Can you expand on your comment with an answer, or link to a better resource in case the one I linked to is incorrect somehow? Also, do you normally utilise the multiple images / links per content item, as I did, or instead have each banner as a separate instance of the content type? – user34185 Oct 22 '14 at 10:53
  • I can confirm that changing the content type to not allow multiple images / links and then using the Rewrite Results works okay - but is there a way to get this working using multiple images / links per content item? It just seems tidier to me, having less content items, when they're not needed. – user34185 Oct 22 '14 at 11:55
  • 1
    That's not something I've tried; the idea of Views Slideshow is that it creates multiple slides, each slide represented by a single node. What you want to do makes sense conceptually, but it's not how the module was written to handle things – Clive Oct 22 '14 at 11:57
  • 2
    So I would put one link and one image in a node, follow Clive's approach, and if I needed to link multiple images and links together I'd create a second content type with a entity reference field for that. – hkoosha Oct 22 '14 at 14:58
0

As pointed out by @Clive and @loolooyyyy in the comments, the problem here is that there were multiple images on a single node. Best practice (and problems like this one) dictate that there should be one node per slide.


Answered to remove this post from 'unanswered' list, all credit goes to the commenters who were here long before me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy