Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am using a menu_block block that displays sub-menus depending on what page the user is. on some pages, there are no sub-menus, so my menu-block is automatically hidden by drupal. how do i force drupal to display my block even if it is empty?

thanks.

share|improve this question
3  
Why would you want to display a block that contains nothing? If you have side-effects from this block showing, then move those instead, so a relevant template for example. – Letharion Apr 11 '12 at 10:29
Hi, thanks. it's a client request. they want to display at least the block title. – Bibokid Apr 12 '12 at 2:35
4  
Try adding   in content if empty, it should come up – 2-Stroker Apr 12 '12 at 9:00

3 Answers

I don't know of a way to explicitly force a block (title) to render if the block content is empty.

I would have hidden the block title from the block itself, and the put the title in an appropriate template.

share|improve this answer

One way would be to actually put something in it... but hide it via CSS. I actually had to do that to accomplish a quick hack to lobotomize some bad legacy code.

share|improve this answer

You could create a second block that simply contained the title and then toggle the block visibility based on whether or not the other block exists. You can achieve this by either turning on the PHP filter module and writing some custom PHP to detect if the first block is present or not, or you can write a custom module to do this if you don't want PHP filter on as noted here: Is there a way to set block visibility programmatically (not using the PHP Filter module)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.