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.
I have the feeling that this feature doesn't work anymore, or I don't understand how it's working.
I have a content with 2 fields : body, and media field.
Media field is optional.
I put media field in left column and body in middle column.
I checked "hide empty regions"
If in the content page the media field hasn't been provided, the div of the left column is displayed anyway, apparently $left is not empty
<div class="field field-name-field-video-event field-type-media field-label-hidden"><div class="field-items"></div></div>
i'm using the last dev version of 22th september
Comment | File | Size | Author |
---|---|---|---|
#8 | 1287302-media-field-empty-no-output.patch | 861 bytes | Dave Reid |
Comments
Comment #1
swentel CreditAttribution: swentel commentedWorks fine here with all other fields - looks like media formatters are rendering something although there isn't something in it. Try experimenting with another field, it that works fine, than it's media.
Comment #2
heyyo CreditAttribution: heyyo commentedYou're right, i just tested with a text field, and the region left is now empty. I have to look on the media module.
Comment #3
heyyo CreditAttribution: heyyo commentedI have just tested this media field without the display suit, the behavior is the same. The media field is displayed even if not filled in the content edition process.
Comment #4
heyyo CreditAttribution: heyyo commentedComment #5
heyyo CreditAttribution: heyyo commentedComment #6
heyyo CreditAttribution: heyyo commentedComment #7
jkaine CreditAttribution: jkaine commentedI can confirm this error: D7.9 + Media 7.x-1.0-rc2
Specifics:
Example of why this is a problem: I have an image that has a border placed on the wrapper div. Standard Drupal behavior is that if a field is empty, the wrapper DIV for the field is not displayed. With this bug, however, the DIV will be displayed-- this shows the border around an empty space.
I have a hacked solution that involves the template.php file and some CSS. If anyone is interested, let me know and I can post here.
Comment #8
Dave ReidConfirmed. Please test the following patch.
Comment #9
Dave ReidComment #10
Dave ReidCommitted to Git along with a small fix to file_view_multiple() (#1396648: With no objects, node_view_multiple() and comment_view_multiple() should return an empty array) to also prevent this from happening with other code out there.
http://drupalcode.org/project/media.git/commit/bad1844
http://drupalcode.org/project/media.git/commit/4071112
http://drupalcode.org/project/file_entity.git/commit/47102f5