I cannot find a related issue reporting this bug so I create a new issue.

This bug can be reproduced by
- creating a multiple value field to page content type
- creating a new page node and adding values to that field

So when you save this page and you can see the class of first field item has even and second one has class odd.

Here is the code in the field.tpl.php

<div class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>><?php print render($item); ?></div>

Note that the $delta of field always starts from 0, which makes the first item has 'even' class.

Just need to swap two class names to fix the bug.

I have checked Drupal 8 and there is no odd and even class used in field.html.twig anymore. So I assume only to fix Drupal 7.

CommentFileSizeAuthor
#2 2556171-2.patch705 byteseric.chenchao

Comments

eric.chenchao created an issue. See original summary.

eric.chenchao’s picture

StatusFileSize
new705 bytes
eric.chenchao’s picture

Issue summary: View changes
Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: 2556171-2.patch, failed testing.

Status: Needs work » Needs review

eric.chenchao queued 2: 2556171-2.patch for re-testing.

eric.chenchao’s picture

Why have this queued test not been runing for 2 months?

eric.chenchao queued 2: 2556171-2.patch for re-testing.

tandroid’s picture

This seems like a bigger issue than we're letting on primarily because it's been in core for so long that switching it now would cause major theming issues on thousands of sites. It would essentially require anyone who hasn't overridden field.tpl.php in their own theme to change all of the theming they've done using these classes. As disappointing as it is to say, I do not think this should be fixed.

vikashsoni’s picture

@eric.chenchao patch apply successfully for me
Thanks

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.