I've got a field template which is rendering a field collection field using the standard field.tpl.php file:
<div class="field-items"<?php print $content_attributes; ?>> <?php foreach ($items as $delta => $item): ?> <div class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>><?php print render($item); ?></div> <?php endforeach; ?> </div>
I want to output the a CSS class inside the div in the loop with some text which comes from a colour field inside the $item variable.
EG. I would like to access the variable such as: render($item['field_colour']); in the loop, but this obviously doesn't work.
What's the best practice for doing this?