I have a View, with a hidden field with a URL, and an image field which has the following property:

Output this field as a link and linked to the URL field: [field_url_slider] and _blank as Target.

I want to change dynamically the behaviour, so when the image is a given one, to rewrite programatically the URL and also the Target.

In hoo_views_pre_render don't see how to do it, because the complete link, i.e. a href="", etc. is not any data of view->result and I don't know if this can be achieved via $view->display (I only want to change a result). So, in a few words, I want to change the HTML output of the Views display for just a result.


I have finally solved using hook_views_pre_render and setting the display of one of the fields to "do not display", and adding as pure HTML around the field, replacing the content with the other field. In other words, by writing at low level the link of the field.

Surely there must be another way of doing this.

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.