The way block.module works is, if any block is empty it does not display. This is a handy way to make dynamic blocks that display depending on the context. In every case I've come across, an empty block is more useful not being displayed. That may be just my opinion, but here's a patch to address the issue:

(see attached)

It could probably be accomplished more eloquently, but I am not yet superfamiliar with the module and I didn't have a lot of time. Hope this helps! :)

CommentFileSizeAuthor
mysite.patch1.69 KBms2011

Comments

agentrickard’s picture

Nope, this is the right fix for the droplets, though I might use an !empty instead of a !strlen (personal preference).

But -- thinking and typing -- if I have added a block to my collection and it _disappears_, then I might think that something is broken.

We should probably just pass an 'empty content' message -- isn't that the behavior now?

agentrickard’s picture

Version: 5.x-2.14 » 5.x-2.15
Status: Active » Needs review

Need to patch against the latest release.

ms2011’s picture

I would not display it. You get the same type of behavior with views when it's not working--it just doesn't appear. I would say that is normal, and although possibly more frustrating to the new Drupal developer, commonplace and more useful in the long-run.

agentrickard’s picture

It isn't the developer that I'm concerned about. It is the end user.

Consider:

- A user is allowed X elements on their page (default is 10).
- The user adds the "Dynamic Block" element and 6 others.
- "Dynamic Block" returns empty.
- 6 elements are shown on user's page.

- User asks "Where the heck is 'Dynamic Block' that I added to my page?"
- User thinks the site is broken.

Because of this case, I think returning an empty message is more appropriate.

I'm also a little confused. Are you saying that Views droplets disappear if they return empty?

ms2011’s picture

Ok, I see your point. Now I would agree with you that it should display an empty content message. Is it possible that the droplet could customize that? Like with views, if you create a block you can also provide Empty Text.

And, I was saying that If you use views to create a block and provide no empty text, and there are no nodes matched and no header or footer text, it will not appear just like any other empty block.

agentrickard’s picture

Status: Needs review » Closed (fixed)

Seems like a valid feature request. Frankly, I hadn't considered cases where the Block or View would be empty.

Can you open a new issue against HEAD describing what you want?

ms2011’s picture

Well, I thought about it some more, and in every case I can think of that I would be using it, I have control over the returned value using PHP. Therefore, I could detect whether the block is going to be empty and provide an empty message from within the block.

So, nevermind it for now.