Posted by Kasberry on March 27, 2012 at 10:10pm
15 followers
| Project: | Panels |
| Version: | 7.x-3.2 |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Just updated to 7.x-3.2 and notices that all the Titles in my custom blocks disappeared. It seems that Panels doesn't fetch the block title from the Blocks module as it has done in previous versions. I solved the problem by going back to 3.1. I don't have the coding skills to fix the problem. Just wanted you guys to know the problem and that it needs some review.
Comments
#1
I can confirm this. After update, the title seems to be missing.
I re-saved the block & panels but does not help.
drush cc allof course too.When I add a custom title in the panel settings of the block, the title is shown, but when I leave it empty or even when I try to use the %title it will not be shown.
#2
Confirming this issue.
Drupal 7.12
Panels 7.x-3.2
#3
This looks like it may be a problem with core, block_block_view will never get a block title:
<?php/**
* Implements hook_block_view().
*
* Generates the administrator-defined blocks for display.
*/
function block_block_view($delta = '') {
$block = db_query('SELECT body, format FROM {block_custom} WHERE bid = :bid', array(':bid' => $delta))->fetchObject();
$data['subject'] = NULL;
$data['content'] = check_markup($block->body, $block->format, '', TRUE);
return $data;
}
?>
and panels checks to see if the block title is set (even though it will always be NULL) after invoking block_view:
<?php$block = module_invoke($module, 'block_view', $delta);
...
if (isset($block->subject)) {
$block->title = $block->subject;
}
else {
$block->title = NULL;
}
?>
It looks like the only place block module actually retrieves the block title, is in _block_load_blocks
<?php
/**
* Loads blocks' information from the database.
*
* @return
* An array of blocks grouped by region.
*/
function _block_load_blocks() {
global $theme_key;
$query = db_select('block', 'b');
$result = $query
->fields('b')
->condition('b.theme', $theme_key)
->condition('b.status', 1)
->orderBy('b.region')
->orderBy('b.weight')
->orderBy('b.module')
->addTag('block_load')
->addTag('translatable')
->execute();
$block_info = $result->fetchAllAssoc('bid');
// Allow modules to modify the block list.
drupal_alter('block_list', $block_info);
$blocks = array();
foreach ($block_info as $block) {
$blocks[$block->region]["{$block->module}_{$block->delta}"] = $block;
}
return $blocks;
}
?>
So we may have to add our own query here to get the block title. I would love some more eyes on my DBTNG and please test the patch :)
#4
Argh. We used to have our own version of _block_load_blocks().
Did that get ruined in the i18nblocks compatibility back and forth?
#5
#3 worked for me so far. Thanks for posting!
#6
Yes the #3 works, but I just found out that this could be related to the ctools change, perhaps we should move this over to ctools issue list?
I analysed problems I had with translation of blocks. The are not translated anymore since ctools 7.x-1.0 Release
I reverted some of the changes between RC1 and final release, which gave me both things back:
So I wanted to link this thread.
Hope I could help a bit, I do not understand everything yet...
#7
What's the status of this? Is that patch getting added back into Panels? Just wondering.
#8
It looks like the patch has been added but I still have problems to see my title. The only way to display my title correctly is to override it with plain text. I can't use the %title replacement either.
#9
I'm pretty sure the latest CTools has this all fixed; at least, it seems to now work in my testing.
#10
Automatically closed -- issue fixed for 2 weeks with no activity.
#11
Just FYI, I had to apply this patch to the latest ctool dev release that I pulled today.