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.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | no.block.display.on.no.content_1.patch | 3.17 KB | robin monks |
| #12 | no.block.display.on.no.content_0.patch | 3.16 KB | robin monks |
| #11 | no.block.display.on.no.content.patch | 3 KB | robin monks |
| no.blocks.without.content.patch | 5.06 KB | ax |
Comments
Comment #1
dries commentedI 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).
Comment #2
ax commentedwant me to make all block titles link to the respective module page?
Comment #3
dries commentedI'd like to discuss this at the very least. :-)
Comment #4
boris mann commentedI 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.
Comment #5
gábor hojtsyTargets 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.
Comment #6
Kjartan commentedOnce 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).
Comment #7
moshe weitzman commentedwe already pass the 'more' link separate from the content. this is about how the core themes should present that 'more' link
Comment #8
Kjartan commentedFrom 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.
Comment #9
boris mann commented+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.
Comment #10
dries commentedI'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.
Comment #11
robin monks commentedThis 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
Comment #12
robin monks commentedChx recommended moving the returns into their relative ifs. This also works on HEAD.
Robin
Comment #13
robin monks commented...wrong patch version...
Robin
Comment #14
mfbLooks good, +1
Comment #15
jose reyero commented+1
Tried the patch, it works
Comment #16
dries commentedCommitted to HEAD.
Comment #17
(not verified) commentedComment #18
(not verified) commentedComment #19
(not verified) commentedComment #20
(not verified) commentedComment #21
(not verified) commentedComment #22
(not verified) commentedComment #23
(not verified) commentedComment #24
ax commentedthere are more blocks that appear without having (any meaningful) content: "recent comments", aggregator category blocks, and more. would be nice if these could be fixed, too. to do this systematically, every _block() should be checked. it would probably be a good idea to include this policy as a coding guideline. in http://drupaldocs.org/api/head/file/contributions/docs/developer/hooks/c... and the handbook.
i'll try to submit a patch for this, but greatly appreciate any help.
Comment #25
lennart commentedsee also this - it relates to some earlier thougts in this issue http://drupal.org/node/24438
Comment #26
ax commentedlennart: linking from block titles is a different issue and should be discussed so (in a separate issue)
Comment #27
robin monks commentedPlease file a new issue on other blank blocks.