Need the ability to detect if the View within the box was empty. For example, so the entire box can be omitted from the page in the block theme file.

CommentFileSizeAuthor
#1 Empty_View-1246544-1.patch644 bytesmpotter
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mpotter’s picture

Status: Active » Needs review
FileSize
644 bytes

Here is the patch. It sets a field called $block->is_empty to TRUE if the underlying View did not return any results and if the user does not have edit access to the box (so the Edit Box link will still normally get shown).

To use this in your block TPL file, you can simple check to see if $block->is_empty is TRUE to decide whether to output the content of the block.

Note that this will not work properly if you are using views within a view.

tirdadc’s picture

Assigned: mpotter » tirdadc
tirdadc’s picture

Status: Needs review » Closed (fixed)

Committed. Should have remembered this before the release!