If a view does not return any results, need to be able to hide it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

brenk28’s picture

This patch adds a "Hide if Empty" checkbox.

jec006’s picture

Status: Active » Needs review
e2thex’s picture

So if this box is checked, and no view is displayed, how does one edit the box?

jec006’s picture

Interesting 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?

tirdadc’s picture

Status: Needs review » Needs work

I 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.

wbobeirne’s picture

Attaching 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

jec006’s picture

Status: Needs work » Needs review
recrit’s picture

updated patch to only look at $content and the view's results, ie no checkbox option to 'hide empty'.