Not sure if this is a Zen issue, or a Drupal 5.2 issue.
But - I've a custom block, and a menu, etc in the sidebar. Each of them has a title - Block Title is the form field when creating such blocks.
When I use the bluemarine theme, the block title shows up correctly in the page.
When I use the zen theme, the $block->content shows up on the page, but there is nothing in title - I looked at the source HTML being sent, so this line in block.tpl.php shows an empty string for subject, though it gets the right data for $block->content.
<h2 class="title"> <?php print $block->subject; ?> </h2>
Drupal issue, or a Zen issue?
Comments
Comment #1
bwooster47 commentedMore testing - this seems like a Drupal issue, nothing to do with Zen.
When any new theme is used, most (not all) $block->subject accesses return empty string.
Steps to reproduce:
Go into the garland theme folder, make a sub-folder named garland-alt
In the garland-alt folder, copy the garland/style.css
Go into Administer and enable the garland-alt theme.
Even though it is exactly the same as garland, the sidebar blocks will mostly be printed with no Block Title.
If you go into Administer and configure the blocks, you'll see that every block has a "Block Title" field - this is supposed to show up. One block title does show up - this is for the "Latest Articles", which shows up when Article module is enabled. Strangely, the configure for "Latest Articles" shows TWO "Block TItle" fields, while all other blocks show a single field only.
This is running on a Linux 2.6.19 system, PHP 4.4.7.
Comment #2
bwooster47 commentedStill digging around this bug.
Right now, only theme that shows non-null $block->subject is bluemarine.
All other themes - including garland - display empty string for $block->subject.
Looked in the "blocks" table using phpMyAdmin - it shows only two themes (one bluemarine, another one contributed) have the "title" column fillled in for these blocks.
Garland has empty string for title, so that explains why there is no headline for blocks.
Anyone have a workaround to fix the blocks table?
I tried disabling the theme, and then re-enabling, that did not work - title column in db is still empty.
I then tried creating another new theme folder - and this created new rows in the block table, but all the blocks it added had empty string from title. So, blocks is being populated incorrectly?
The Site Building -> Blocks admin page is all correct - it shows the blocks and the configure button for the blocks shows the title. Therefore, at least some table has the info, but not the blocks table.
Comment #3
bwooster47 commentedThis seems like a block.module problem?
In my 4.7.6 site, I see that there is a table called "boxes" which keeps the title of the box.
But looks like in 5.2, the title has been moved to the "blocks" table - which has rows for each theme, so title needs to be repeated each time a new theme is seen. This seems like a de-normalization of the boxes table - for perfomance? There is certainly no way in the admin pages (that I can see) that allows blocks/boxes to have different titles for different themes.
Still don't know how to fix this, if anyone has any tips/info to add, please do this. This is one of the reasons I'm sticking with 4.7.x, can't move until all 5.2 bugs are resolved.
Comment #4
bwooster47 commentedOK, after experimenting - here's my analysis.
1) If a theme existed and was enabled (does not have to be default, just enabled) before the upgrade from 4.7.x to 5.2, then the upgrade script properly creates the block table, making as many copies of the block title as needed (copying from the boxes table).
2) if after you upgrade to 5.2 you enable an theme - that results in the bug.
It leaves out the title column for the blocks, and therefore, the sidebar will not display the titles of the blocks anymore for that theme.
So, one workaround seems to be to have all the themes you need in 5.2 also enabled in 4.7.x - clumsy, but maybe the only solution. Sure seems that the 4.7.x boxes table structure was far better than the 5.2 version!
Comment #5
bwooster47 commentedAnyone have any thoughts on this? Enabling new themes causes old existing blocks to fail to display properly, seems to be related to the change in the DB schema, looks as if now instead of a single definition of a block, each theme has to copy/repeat the definition, resulting in failures because this copy is not done at all appropriate times - like when adding/enabling a new theme.
Comment #6
domesticat commentedI can confirm I'm seeing this as well in drupal v5.3. Block titles show up in Garland but are gone in contributed themes. The code to print block titles appears to be identical in Garland and zen.
Comment #7
domesticat commentedI'm trying to find solutions to this as well. I checked my db schema and confirmed that if I add a new theme and then try to add a previously-existing block to the new theme, the title field wasn't populated.
What I found, though, is that if I add new blocks in the new theme, the title field is saved correctly.
Comment #8
maxiorelHm, this doesn't work for me. Block subjects are still empty :-(
Comment #9
mckoss commentedI'm seeing a similar problem on my site. Changing to the Zen theme, we lost some block titles. I note that the block.tpl.php template has this code:
if ($block->subject):print $block->subject;endif;And, it's true that $block->subject is empty when some of my blocks are displayed. If I go an configure the block again and RESAVE it, now the $block->subject property is no longer blank.
I put some debug code in my block template just to see what properties of the $block are available.
The results are:
module:block
delta:9
theme:zen_classic
status:1
weight:-8
region:right
custom:0
throttle:0
visibility:1
pages: countdown
title:StartPad Countdown Sponsors
subject:StartPad Countdown Sponsors
I don't know why there is now BOTH a $block->title and a $block->subject property (before my re-saving the block, both were empty. Other blocks on my page have an empty $block->title). Is there a Drupal bug where some themes assume the title of a block is in one property and not the other?
Comment #10
pat7471 commentedHey guys,
I'm on Drupal 5.7 and I'm seeing similar issues. After changing to a new custom theme, the subject on all my sidebar blocks are missing.
I've tried searching all over the internet, finding more people having the same issues but no solution whatsoever.
This morning, I tried editing the blocks with issues (in this case "reconfiguring"). Upon saving, the subject of that particular block returns. So I proceed to reconfigure the rest, and I'm seeing them all now.
Hope this will help those with same issue as I.
Comment #11
trew_t commentedIf i edit and re-save the blocks (no changes made) the problem gets fixed.
Also make sure all blocks actually have a block title (and not just a description).
Comment #12
gregrenner commentedSubscribe
Comment #13
samsabra commentedThis is still happening in Drupal 6.8! I have created a theme with 3 sub themes. The $block->subject variable is empty on the sub themes! I had to open each block and save it under each sub theme for the $block->subject variable to return its proper value.
Comment #14
jazzdrive3 commentedThis works. But what if you have over 250 blocks? Do we need to open and save each one? Is there a way to do it with a temporary script?
I'm on Drupal 5.16.
Comment #15
cmayberry commentedI am having this problem and on top of it the blocks wont allow me to open and save them they throw this error error
"Please ensure that each block description is unique."
Any suggestions for working around either the original problem or the error so I can save them again?
Comment #16
kg9ov commentedThis issue still exists in 6.10, system_initialize_theme_blocks() does not populate the title field in the blocks table when a new theme is enabled.
Patch updates system_initialize_theme_blocks() in system.module to initialize the title field when the blocks table entries are created for the newly enabled theme. Also adds a new system_update_NNNN() in system.install to populate missing titles in existing rows in the blocks table.
Comment #17
himerus commentedwould definitely be nice to see this working correctly. I'm using latest 6.x release (13) and this issue is still present with custom blocks.
I would have never noticed this if I hadn't been building out a contrib theme/sub-themes as I usually don't use the block subject/title field in my normal theming.
It seems to only happen on the custom created blocks, as ALL of the system blocks, or blocks supplied by contrib modules works fine.
I can't see how it's possible this issue has been looked over for so long.
Comment #18
webcomm commented+1
Comment #19
andyhu commentedThe problem still exists
linksys e2000 review
Comment #20
fuerst commentedPatch in comment #16 works well for me.
I created a new one though to make it compatible to Drupal 6.13.
Comment #21
gábor hojtsyBugs are first fixed in the current development version to ensure that when you happen to update to that version, the bug does not return. So moving this to 7.x and marking needs work. Fixing bugs in the 6.x branch without fixing them in 7.x is calling for trouble with regressions.
Comment #22
fuerst commentedCurrently I do not have time and necessary knowledge to port this to D7. So hopefully someone other can jump in and remove that nasty bug.
Comment #23
marcoBauli commentedSame problem, weird this bug is here since so long.. manually applied the patch to D6.14 (updating the number of the db update, run update.php), but still cannot pull out anything from
print $block['subject'];this is 'critical' for any project involving serious theming..
thx
PS: re-saving the blocks, turning on/off theme, clearing any cache did not help
Comment #24
fuerst commentedOnly deleting and recreating a block will help if you don't have this patch applied IIRC.
Comment #25
marcoBauli commented@fuerst: thanks, actually the update went smooth and copied correctly custom block titles in the respective tables of the patch, but still titles cannot be pulled out.. also tried to create brand new custom block but nothing.
Works fine with Views blocks, Comment blocks and others, but fails with custom ones.
Comment #26
warmnoise commentedI've recently stumbled across this thread, and noticed there is similarity to what I have seen. The general use case is creating a cloned theme, and switching to the new one.
Similar to patches above, I had to override system.module to ensure that the block titles were copied over. My detailed findings are in this thread:
#521668: Block Title missing on custom blocks when switching default and enabled theme
Comment #27
ericpai commentedI'm having a similar problem with version 6.19.
I tried calling a block programmatically but it's not displaying the block title.
Here is code in my page.tpl.php or node.tpl.php:
The block body is displayed, but not the subject.
Comment #28
avpadernoSee what reported in comment #21.
Comment #29
webcomm commentedI think this bug still exists in 6.22. The #15 patch didn't fix this for me.
If I use module_invoke to get a block, and then var_dump the data, I see the content but I see no subject. For some blocks, the subject is an empty string. For other blocks, the subject isn't in the array at all. I've confirmed that the blocks have a value in the "title" column in the blocks table.
Comment #30
Fayna commentedAt first I thought this was my own fault--that perhaps I needed to print the block title in my theme to get it to show up at all. However, my views blocks had their titles displaying correctly. Its only my custom block, even when resaved, that won't show its block title. This is with a brand new 6.22 install and using the 'basic' theme. Hopefully this will be resolved soon. I'll try the patch above, but since it was for earlier versions of 6.x, I feel like this will be farfetched.
Comment #31
crystalidea commentedThe problem still exists in the latest version of drupal 6.35
Comment #33
quietone commentedThis tag is used once on drupal.org.
Removing tag per Issue tags field and Issue tags -- special tags for issue #3565085: Drupal core issue tag cleanup.