You could try theming the field using field.tpl.php
or theme_field()
.
As an example (using field.tpl.php
):
- Copy
field.tpl.php
to your theme directory from "modules/field/theme"
- Make a copy of that file and rename it to
field--field-channel.tpl.php
- Edit the file however you like.
As a quick/dirty example for this to work, field--field-channel.tpl.php
could look like:
<div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
<?php if (!$label_hidden) : ?>
<div class="field-label"<?php print $title_attributes; ?>><?php print $label ?>: </div>
<?php endif; ?>
<div class="field-items"<?php print $content_attributes; ?>>
<?php foreach ($items as $delta => $item) : ?>
<div style="display:inline;" class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>>
<?php
print render($item);
// Add comma if not last item
if ($delta < (count($items) - 1)) {
print ',';
}
?>
</div>
<?php endforeach; ?>
</div>
</div>
There are probably multiple ways to accomplish this using the .tpl file, but this is just one option. I recommend adding a class to the DIV instead of a style and make the changes in your stylesheet instead of using inline styles.