0

I have an image field on a taxonomy term. I am retrieving it via field_view_field and render it afterwards to display it. But I would like to give it a custom link. How to do this? Do I need to make a new image formatter, with a link as configuration property? Or is there another solution to add the link before the render?

Thanks!

1

Problem with that module is that you have to define a token or fixed link. I am writing code that create a link on the fly, that can change in time.

For example: displaying the image of a taxonomy term, with a link to the last added node having this term.

The easiest solution: $image = render(field_view_field(……)); $output = l($image, $link, array('html' => TRUE));I

When I tried this earlier it wasn't working, because by default the HTML option is set to false, displaying HTML code instead of rendered HTML code.

| improve this answer | |
0

Check if Image Link Formatter module works for you.

allows an image field to be displayed with a link to a custom URL:

Please check the project page as it has similar module suggestions as well.

| improve this answer | |
  • Thanks for your response. This was a possible solution. But I was able to do it in an easier way. – nicolasleroy Oct 3 '13 at 15:34

Your Answer

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

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