Problem/Motivation

If you have a multiple field containing 1 item and if this field is configured to skip the first item, an empty field markup will be output.

Steps to reproduce :

  1. Create a field field_myfield of type text with multiple values on any content type
  2. Configure that field display to skip the first item
  3. Create a content using that field with only one value in field_myfield
  4. Display that content and look at the HTML output

Current HTML output :

<div class="field field--name-field-myfield field--type-text field--label-hidden">
  <div class="field__items"></div>
</div>

Expected HTML output :
No <div class="field field--name-field-myfield field--type-text field--label-hidden"> at all.

Proposed resolution

Hide the entire field if there is no remaining item to show.

Remaining tasks

Contributor tasks needed
Task Novice task? Contributor instructions Complete?
Create a patch Instructions
Manually test the patch Novice Instructions
Review patch to ensure that it fixes the issue, stays within scope, is properly documented, and follows coding standards Instructions

User interface changes

None

API changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DuaelFr’s picture

Assigned: DuaelFr » Unassigned
Issue summary: View changes
Status: Active » Needs review
FileSize
417 bytes

  • rootwork committed edff030 on 7.x-1.x authored by DuaelFr
    Issue #2466649 by DuaelFr: Hide the entire field if there is no...
rootwork’s picture

Status: Needs review » Fixed

Patch applies and fixes the bug. Pushed to latest dev. Thanks @DuaelFr for fixing.

rootwork’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.