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 a view and some nodes have associated video. If there's no video, we detect that the rendered field is empty and display instead the image.
If I use the html5_player formatter from html5_media, the returned view shows no output from the media field with no data. When switched to Mediaplayer, the view renders instead an empty set of media player controls.
Possibly a regression of #1000432: Hide player when an empty view is returned. for 7.x-2.x?
Comment | File | Size | Author |
---|---|---|---|
#1 | mediaplayer-1704402-dont_return_empty_controls.patch | 517 bytes | xurizaemon |
Comments
Comment #1
xurizaemonI see that you're accepting an array of fields (rather than just a field label) so have included a foreach to pick up if the field(s) are empty or not.
I'm not familiar with the module so this might not be the ideal approach - may be inappropriate if the array is for fallback, may not be right for playlist usage, but works for me today :D
Comment #2
travist CreditAttribution: travist commentedLooks good to me. I just added an
if (!empty($args[1]['variables']['#fields']))
around it so that it only applies to that specific use case.Committed to HEAD with attribution. Thanks for your contributions!
Travis.
Comment #3
travist CreditAttribution: travist commentedI just noticed that this breaks a grid view player display in Views. I had to revert to figure out what is going on here...
Comment #4
travist CreditAttribution: travist commented