Skip to main content
edited title
Link
Patrick Kenny
  • 29.3k
  • 19
  • 139
  • 316

Add class to views row using a template

Source Link
Ben
  • 1k
  • 2
  • 15
  • 33

Add class to views row

I'm using Views 3 with Drupal 7. I'm trying to dynamically add a class to the "views-row" line of a view based on the node type. I have a view with a relationship which is duplicating items when a relationship exists. I thought by adding a class for the node type into the views-row line I could hide the field in the row. I'm not sure whether I should be overriding views-view-unformatted.tpl.php or views-view-fields.tpl.php, to add the class and how I can extract the node type from the data to add it into the the classes for that line.

I'd be grateful for any guidance.

Ben