0

How do I rewrite views field result programmatically? I want to change the link basing on another field value.

I have a field called room typ,e which is a reference to taxonomy terms (Bedroom / Meeting Room). The second field is the node ID, which I want to use to give the link of the page (there are two different page: Enquiry and Booking). If the selected term is Bedroom, I want to link the Booking page; if the selected term is Meeting room, the link should be Enquiry. I want to change the link text for Meeting room: It should be Enquire Now and Book Now.

2 Answers 2

1

You could add news fields to your vocabulary for the link text ('Enquire now') and for the href ('Enquiry')

You'll add these new fields to your view, and then you will be able to format your link like nandhana said. And the reference will do the rest ...

But be sure that the 'nid' is the lower field among all others, so that you can access to all others fields

0

For Example : You give title link for images:

<a href="[title]">[field_image]</a>
1
  • Thanks for quick reply. but I have added some more details Commented Dec 31, 2014 at 7:48

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.