I want to output a field collection using dl
, dt
and dd
tags. The collection has two fields - field_heading
and field_text
. I want each field_heading to be a dt, each field_text
to be a dd
and to wrap the whole set in a dl
.
I have achieved this by overriding field--my-collection--my-content-type.tpl.php
and the field--my-field.tpl.php
for the heading and text fields.
The problem is, a div
is being generated on each item in the field collection (by the field collection module I believe). (div class="field-collection-view clearfix view-mode-full"
) This div wraps the heading and text elements together. The div is therefore inserted inside the dl
but before the dt
. This is a problem because the dt
needs to be a direct child of the dl
.
Is there a way to render the field collection without this div?
field--my-collection--my-content-type.tpl.php
<dl class = 'accordion'>
<?php foreach ($items as $delta => $item){ ?>
<?php print render($item); ?>
<?php } ?>
</dl>
field--field-heading.tpl.php
<dt>
<?php foreach ($items as $delta => $item){
print render($item);
} ?>
</dt>
field--field-text.tpl.php
<dd>
<?php foreach ($items as $delta => $item){
print render($item);
} ?>
</dd>