Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Omega's override of theme_field() allows attributes to be set for each field item, as a preprocessor function can set $variables['item_attributes'][$delta]:
$classes = 'field__item ' . ($delta % 2 ? 'odd' : 'even');
$output .= '<div class="' . $classes . '"' . $variables['item_attributes'][$delta] . '>' . drupal_render($item) . '</div>';
However, the CSS class can't be set, as that is hardcoded and only has field__item and the odd/even class. It would be useful to also have $variables['item_classes'][$delta].
Comments