The issue at hand is to change the display of one of a View's fields, based on a condition in another field of the same View. The field to be affected is the display of checkboxes associated with Flag Lists/List Operations. The conditional field would have a value "yes" or "no" and would be excluded from display. Ideally, the checkbox would simply be absent if the value is "no." Alternatively or additionally, it would be helpful to display a message explaining why the item can't be selected to include in a list. Can anyone provide suggestions for a general approach? Thank you for any help and suggestions.
By conditional field do you mean a simple Boolean? If so, you should be able to pull this off with some tactical field rewriting.
When creating the Boolean in your content or entity type, have 'Yes' as the only value, leaving the unchecked state assumed as no. Then in views add the flag list field first and exclude. Next the Boolean but don't exclude. Use its default formatting not its key. In its settings rewrite using the flag list field replacement pattern, and in the empty behaviour (eg the result of the empty checkbox when no value has been specified for it), choose to hide rewriting.
You may need to fine tune this or perhaps add additional fields, chasing the replacements until it works. You'll be amazed at the sophisticated conditions you can set up in this fashion.
maybe Views Conditional could be useful for small conditionals:
Views Conditional is a simple module that allows you to define conditionals (if xxx then yyy). with fields in views. Conditions include:
- Equal To
- Not Equal To
- Greater Than
- Less Than
- Not Empty