I'm a recent display suite convert and I'm wondering how I could add a dynamic class to a field using display suite.

Seems like that the only way to do this is to override the theme_ds_field_expert function in my theme. I was wondering if there was a more elegant way to proceed with this? Here's the scenario, in case that helps:

  • Node contains a term reference field
  • Each term value should get its own icon, which I would like to display via CSS
  • Using the "expert" field template
  • Would like to dynamically add the value of the field as a CSS class on the wrapper element of the field.

Comments

swentel’s picture

Status: Active » Closed (won't fix)

That's extremely hard. The easiest way is to create a custom field template either through core of display suite. see hook_ds_field_theme_functions_info in ds.api.php