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.
If a view does not return any results, need to be able to hide it.
Comment | File | Size | Author |
---|---|---|---|
#8 | views_boxes-handle-empty-views-1355226-8.patch | 1.71 KB | recrit |
#6 | empty-block-remover-1355226-6.patch | 1.71 KB | wbobeirne |
#1 | hide-if-view-empty-1355226-1.patch | 2.19 KB | brenk28 |
Comments
Comment #1
brenk28 CreditAttribution: brenk28 commentedThis patch adds a "Hide if Empty" checkbox.
Comment #2
jec006 CreditAttribution: jec006 commentedComment #3
e2thex CreditAttribution: e2thex commentedSo if this box is checked, and no view is displayed, how does one edit the box?
Comment #4
jec006 CreditAttribution: jec006 commentedInteresting question. I think boxes in general needs a better way to handle empty-ness. Maybe this is a question that should be addressed at a higher level?
I definitely see a need for hiding a view box to the user if the view is empty. Perhaps people with privileges to edit it should see a 'this box appears empty' placeholder?
Comment #5
tirdadc CreditAttribution: tirdadc commentedI posted a response to the related ticket in the Boxes queue. I don't think the checkbox approach is the best way to do this considering we can now have inline editing for empty boxes for users with the right permissions. Allowing plugins to return nothing seems to be a better option.
Comment #6
wbobeirne CreditAttribution: wbobeirne commentedAttaching a slightly different patch that also marks the title as '' when there's no content, else you'll have a floating title. Works in conjunction with this patch: http://drupal.org/node/1440178#comment-5600730
Comment #7
jec006 CreditAttribution: jec006 commentedComment #8
recrit CreditAttribution: recrit commentedupdated patch to only look at $content and the view's results, ie no checkbox option to 'hide empty'.