2

In my Drupal 7.8 website (with the Views and Panels modules installed), I'm trying to display a view pane in a panel. However, I only want to show certain fields in that pane if another field has a certain value.

Example: I display fields Foods, Healthy, and Unhealthy from a node using a custom view pane. But I only want to display fields Healthy and Unhealthy if field Foods (which is a multi-select field) contains the value "Cheetos"

Does anybody know how I can do this with a plugin or with views default functionality?

1 Answer 1

5

Solution1: You can add filter in view by selecting and restricting the value of "Foods" field since if foods has the selected option then only it will display the results.

Solution2: Just add one more field with php custom field(use views customfield module) and exclude display of all other 3 fields. In this php field you can get all the previous field values in $data variable so you can print the result as you wish by validating using php.

Hope this can help you out!

1
  • Wow! Yep! That's great! The php custom field is exactly what I wanted -- and it helps solve several other problems. Thanks!
    – BenjaminRH
    Oct 9, 2011 at 22:20

Your Answer

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

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