Wrapper divs get printed for empty fields

Created on 29 September 2012, over 12 years ago
Updated 11 June 2025, 2 days ago

I'm using Styles with the Media module and noticed that upon selecting a file style format, the wrapper divs of that field would get printed, even if the field is empty:

<div class="field field-name-field-header field-type-file field-label-hidden clearfix"><div class="field-items"></div></div>

I think it has to do with the styles_field_formatter_view function, where the $element array will always have the #formatter value, even if there are no items to be displayed.

I attached a small patch to fix this issue.

πŸ› Bug report
Status

Closed: outdated

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium Rodlangh

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9

    Thank you for your contributions to this issue. As Drupal 7 has reached its End of Life and is no longer supported, we are closing this issue. We encourage you to upgrade to a supported version of Drupal.

Production build 0.71.5 2024