How can I access a single item of a grouped field, e.g. in the template file views-view-fields.tpl.php. I use a content type where I can specify multiple authors, and these authors are grouped in the view.

I can print the grouped field with <?php print $fields['field_author_value']->content; ?>

The printed HTML will look like this:

<div class="field-item">author1</div>
<div class="field-item">author2</div>
<div class="field-item">author3</div>

But how can I access each item separately?

Comments

Jezze’s picture

Does no one has a hint for me?

Well, I could extract the content between <div></div> with a regular expression, but that's not really nice. I was hoping there would be a solution in which the grouped field is returned as an array.

Thanks anyway! :)

Maybe someone still knows a better way than regular expressions.

esmerel’s picture

Status: Active » Closed (fixed)

Given the age of this issue, I have to hope it's either resolved or no longer relevant.