[drupal-devel] [bug] don't show blocks if they have no content

Robin Monks drupal-devel at drupal.org
Mon Jun 13 12:57:06 UTC 2005


Issue status update for http://drupal.org/node/7897

 Project:      Drupal
 Version:      cvs
 Component:    base system
 Category:     bug reports
 Priority:     normal
 Assigned to:  Robin Monks
 Reported by:  ax
 Updated by:   Robin Monks
 Status:       patch
 Attachment:   http://drupal.org/files/issues/no.block.display.on.no.content_1.patch (3.17 KB)

...wrong patch version...


Robin




Robin Monks



Previous comments:
------------------------------------------------------------------------

May 19, 2004 - 18:06 : ax

Attachment: http://drupal.org/files/issues/no.blocks.without.content.patch (5.06 KB)

blog, forum, and statistics.module show their blocks even if they have
no contents. this looks quite dull, eg.



+----------------------+
| Forum topics         |
|                      |
| Active forum topics: |
|                      |
| New forum topics:    |
|                      |
| more                 |
+----------------------+

+----------------------+
| Popular content      |
|                      |
| Today's:             |
|                      |
| All time:            |
|                      |
| Last viewed:         |
|                      |
+----------------------+
and isn't what the rest of the drupal blocks do (not showing up if
there is no content). this patch fixes this. additional improvements:


* removed the "more" links from blog and forum.module and replaced them
with block titles linking to the respective module page. rationales:
  + "more" means there are more blog entries/forum topics than those
linked from the blocks. this, however, wasn't always the case.
  + it is common user expectation that the title of a "content
excerpt" links to the complete content. examples: node titles on the
homepage, links in admin tables, tracker, etc.
  + it saves screen estate
* fixed the forum link description ('Read the latest forum topics.' >
'Go to the forums.')
* added a link from the 'Popular content' block title to the 'Most
popular content' page (statistics). this wasn't accessible before.


please review and apply.




------------------------------------------------------------------------

May 20, 2004 - 14:23 : Dries

I haven't tested the patch yet but it would be nice if more block titles
were links (eg. the title of the archive block could link to the main
archive page).




------------------------------------------------------------------------

May 31, 2004 - 22:24 : ax

want me to make all block titles link to the respective module page?




------------------------------------------------------------------------

June 2, 2004 - 18:56 : Dries

I'd like to discuss this at the very least.  :-)




------------------------------------------------------------------------

June 2, 2004 - 19:47 : Boris Mann

I don't want clickable block titles! This is a theming issue, and I
don't think it should be in by default. What is wrong with the "more"
link?


Empty blocks not displaying content (i.e. block doesn't show at all) is
OK for some blocks, not OK for others. This would ideally be a
configuration option: "display even if empty" and a checkbox.


I've always wanted "Active" and "New" forum topics a) either split into
two blocks or b) made it configurable to display one or the other or
both.




------------------------------------------------------------------------

June 2, 2004 - 19:51 : Goba

Targets for block title links could be provided by modules, but it is
after all the decision of modules to print out block titles using those
links.




------------------------------------------------------------------------

June 3, 2004 - 11:26 : Kjartan

Once upon a time blocks defind a link along with the subject and
content. I think we should re-introduce it, and have it replace the
more link that some blocks add. This way themes can choose how and
where they put the link (title, text, icon, etc).




------------------------------------------------------------------------

June 3, 2004 - 12:53 : moshe weitzman

we already pass the 'more' link separate from the content. this is about
how the core themes should present that 'more' link




------------------------------------------------------------------------

June 3, 2004 - 12:58 : Kjartan

>From my quick look at blocks in HEAD this is not true for the aggregator
or blog blocks, they have specific div & CSS class around them yes, but
they are not 100% controlable in the theme.




------------------------------------------------------------------------

June 3, 2004 - 17:18 : Boris Mann

"
Once upon a time blocks defind a link along with the subject and
content. I think we should re-introduce it, and have it replace the
more link that some blocks add. This way themes can choose how and
where they put the link (title, text, icon, etc).


"
+10!! Yes, make more block stuff themeable.


This is a great solution, since you could also add a "link" field to
custom blocks that would display in the same way. Ideally, both the
text (e.g. "more", "check this out", "extra stuff", etc. etc.) and the
link would be configurable, and the theme would take care of how this
is displayed.




------------------------------------------------------------------------

June 17, 2004 - 18:52 : Dries

I'm marking this patch 'active' as we agreed to disagree with the
suggested patch/approach.  Please resubmit or split your patch in
smaller chunks.  Thanks.




------------------------------------------------------------------------

June 13, 2005 - 12:28 : Robin Monks

Attachment: http://drupal.org/files/issues/no.block.display.on.no.content.patch (3 KB)

This patch fixes the actual goal of the bug "don't show blocks if they
have no content".


This is basically ax's patch broken up and updated to HEAD.  This
patches forum.module and stats.  It's been tested to work on CVS HEAD.


I'll take responsibility for upcoming changes to this patch.


Robin




------------------------------------------------------------------------

June 13, 2005 - 12:55 : Robin Monks

Attachment: http://drupal.org/files/issues/no.block.display.on.no.content_0.patch (3.16 KB)

Chx recommended moving the returns into their relative ifs.  This also
works on HEAD.


Robin







More information about the drupal-devel mailing list