I have a content type "slideshow" with three fields: 1. title 2. image 3. entity reference to nodes of a specific content type.

Then I created a view which I want to display as a slideshow on the frontpage. Its filter is set to the content type "slideshow" and I have three fields there: 1. the entity reference to the nodes (hidden) 2. image 3. title

What I want to achieve is, pass the referenced node from the entity field as a link to the image field so that the image in the slideshow has a link to the node from the entity reference field.

I tried the following:

In 2. image field settings: I checked: Output this field as a link and in the link path I put: [field__slideshow_link_gallery] which I got from the replacement patterns below.

The problem is that the image actually has a link but the link is the name of the referenced node rather than the link to the referenced node. I would need the link not the name.

In the 1. entity reference field in the view I have only three formatters (label, entity id and rendered entity). I used label as a formatter and checked "Link label to the referenced entity. Unfortunately only the name is passed to the image not the link. Any ideas would be greatly appreciated.

1 Answer 1

  1. You can select the entity I'd formatter and set the image link to 'node/'[your_token_here]
  2. Use the views image field template (see the views theme information) to wrap it with the link
  • Thanks for the quick response. I set the entity ID formatter to token. I then set the image link to [field__slideshow_link_gallery]. But the output of the link then is: localhost/269 (where 269 is the token ID). Not sure what you mean with 'node'/[your_token_here]. I don't have a [your_token_here] in my replacement patterns. Maybe you could elaborate on your answer a bit more. This would be greatly appreciated. Thanks.
    – Christoph
    Commented Aug 12, 2013 at 17:35
  • [field__slideshow_link_gallery] equals to the nid if the formatter of the reference field is 'entity Id', that means that you can use the static string 'node/' with the [field__slideshow_link_gallery] token and the output will be something like 'node/269' which is the URL to the node.
    – rreiss
    Commented Aug 12, 2013 at 17:50
  • Thanks, Rotem. Thanks for pointing out the obvious too me. My bad. Very much appreciated.
    – Christoph
    Commented Aug 12, 2013 at 19:18
  • Can you please mark it as answer? Glad I could help :)
    – rreiss
    Commented Aug 12, 2013 at 20:52
  • 1
    I don't seem to have enough reputation for doing so. I get a message that I would need 15 reputation.
    – Christoph
    Commented Aug 13, 2013 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.