I'm using the Views module and Drupal 7 and want to add a class to all rows of my table that have a certain value for a certain field.
The field is a bit field and is included in my query. I have added a PHP field (a separate Views module that is installed) with the following code:
if ($row->field_kampioen || $row->field_spirit) {
return 'views-table-highlight';
} else {
return '';
}
This should allow me to set the row class to [php]
. This works, but all rows get the css class. When I output this for debugging:
return $row->field_champion . ' ' . $row->field_spirit . ' ';
I see that the classes are all different numbers, and field_champion
is equal to field_spirit
. This makes me think I'm seeing the ID.
How can I get a TRUE
of FALSE
? So, how can I get the actual bit value of this field?
It would be nice if I could do this via the Views module only, but I've seen pages where hooks are used. Maybe I'll have to use that.