In my view I have a number of fields. One of these fields uses the Output As Link option. This works fine. However, I only want it to be a link if certain criteria is met - so, for example, if the field "sold_online" is true, then the field "price" should be a link to the online shop, while if "sold_online" is false, then the price should not be a link.
What's the easiest way to do this? Write a custom field handler that extends what? Is it views_handler_field_url? In a custom handler, how do I check for the value of another field (assuming "sold_online" comes before "price" in my list of fields)? Or am I barking up the wrong tree and there's something much simpler I should do (for example, using theming?). (And is there a handbook page or anywhere where you can find a list of other people's custom view handlers?)
Worth checking out if you haven't already. http://drupal.org/project/views_customfield http://drupal.org/project/views_customfield *
Ryan LeTulle*
bayousoft http://twitter.com/bayousoft -twitter
On Wed, Apr 6, 2011 at 3:58 PM, DTH david@hartster.org wrote:
In my view I have a number of fields. One of these fields uses the Output As Link option. This works fine. However, I only want it to be a link if certain criteria is met - so, for example, if the field "sold_online" is true, then the field "price" should be a link to the online shop, while if "sold_online" is false, then the price should not be a link.
What's the easiest way to do this? Write a custom field handler that extends what? Is it views_handler_field_url? In a custom handler, how do I check for the value of another field (assuming "sold_online" comes before "price" in my list of fields)? Or am I barking up the wrong tree and there's something much simpler I should do (for example, using theming?). (And is there a handbook page or anywhere where you can find a list of other people's custom view handlers?) -- [ Drupal support list | http://lists.drupal.org/ ]
Cool; I think I had come across this module before without really understanding what it did. Playing around with this, it allows me to do exactly what I want. Cheers!
On 6 April 2011 22:03, Ryan LeTulle bayousoft@gmail.com wrote:
Worth checking out if you haven't already. http://drupal.org/project/views_customfield http://drupal.org/project/views_customfield
Ryan LeTulle*
bayousoft http://twitter.com/bayousoft -twitter
On Wed, Apr 6, 2011 at 3:58 PM, DTH david@hartster.org wrote:
In my view I have a number of fields. One of these fields uses the Output As Link option. This works fine. However, I only want it to be a link if certain criteria is met - so, for example, if the field "sold_online" is true, then the field "price" should be a link to the online shop, while if "sold_online" is false, then the price should not be a link.
What's the easiest way to do this? Write a custom field handler that extends what? Is it views_handler_field_url? In a custom handler, how do I check for the value of another field (assuming "sold_online" comes before "price" in my list of fields)? Or am I barking up the wrong tree and there's something much simpler I should do (for example, using theming?). (And is there a handbook page or anywhere where you can find a list of other people's custom view handlers?) -- [ Drupal support list | http://lists.drupal.org/ ]