I'm trying to get the value of a field and use it as a class for a wrapper of another field within a Views display. So essentially what I need is to be able to get a string representation of the first field. The field already is a text field but when I try getting the content it doesn't just give me a string, which is what I need to be able to use is as a class for my second field.
I've tried using {{ fields.[field_name].content }}
but that renders the twig template recommendation along with the data. I tried using the getValue()
function, but that doesn't return anything. I tried passing the data through the raw
twig filter but that doesn't return anything. I tried rendering the array using dpm and kint but they both give me way too much information and I can't narrow it down to what array item or object I need to use. I'm new to Drupal so maybe I'm not using Devel and Kint correctly to find what I'm looking for.
Is there a function I have to use to get the content data as a string or just raw, or is there some other way I can accomplish this?
I am using Drupal 8.1.