Re: How to hide a block when it has no contents? |
by Madfish on 2015/2/19 0:55:07 Ok thanks, the culprit was that I was passing some display preferences inside $block. Now I check to see if there are any content objects and if not, set $block = array(); and its fine. |
Re: How to hide a block when it has no contents? |
by fiammybe on 2015/2/16 8:54:11 You might use also the count() function on your variables that can be empty. That could come in handy if you generate content in your block content that isn't dependent on the number of elements you want to display. |
Re: How to hide a block when it has no contents? |
by skenow on 2015/2/15 7:17:36 Is the block returning something (like markup), even when there aren't any results? Generally, if $block.content is empty, the block will not display |
How to hide a block when it has no contents? |
by Madfish on 2015/2/12 22:48:14 Is there a way that I can make a block hide itself if it has not contents? Say I have a 'recent articles' block, which can be filtered by tag. For some tags, there are no articles, but the title of the block still displays. What I would like to happen is, if there is no content in a block, it does not display the block title or anything else. It just doesn't display. I've tried setting $block['title'] = '', or not returning $block, but the title still shows up. Any ideas? |