A lot of modules I see -- mine included -- check to see if the block content they generate is empty in hook_block before setting $block['content'] and $block['subject'].
As far as I NOW know, this isn't necessary -- you can just set content and subject and Drupal core will take care of not showing anything if the content is empty.

This detail could do to be added to the docs for this hook.

Comments

karschsp’s picture

Issue tags: +Novice

tagging for novice queue

kresimir’s picture

Assigned: Unassigned » kresimir
kresimir’s picture

Assigned: kresimir » Unassigned
Status: Active » Needs review

In the function hook_block_view documentation, it already states:
'If the "content" element is empty, no block will be displayed even if "subject" is present.'
http://api.drupal.org/api/function/hook_block_view/7

joachim’s picture

Looks like it's already been fixed!
And backported to 6 too: http://api.drupal.org/api/function/hook_block
Could backport to 5 I suppose -- I don't know if there's a policy on whether to do that or not though.

catch’s picture

Version: 7.x-dev » 5.x-dev
Status: Needs review » Patch (to be ported)
jhodgdon’s picture

Status: Patch (to be ported) » Fixed

It's been fixed in Drupal 5 as well.

Status: Fixed » Closed (fixed)
Issue tags: -Novice

Automatically closed -- issue fixed for 2 weeks with no activity.