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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Cyclodex’s picture

I can confirm this. After update, the title seems to be missing.
I re-saved the block & panels but does not help.
drush cc all of 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.

darthf1’s picture

Confirming this issue.

Drupal 7.12
Panels 7.x-3.2

jenlampton’s picture

Status: Active » Needs review
FileSize
884 bytes

This looks like it may be a problem with core, block_block_view will never get a block title:

/**
 * 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:

  $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

/**
 * 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 :)

merlinofchaos’s picture

Argh. We used to have our own version of _block_load_blocks().

Did that get ruined in the i18nblocks compatibility back and forth?

JSCSJSCS’s picture

#3 worked for me so far. Thanks for posting!

Cyclodex’s picture

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:

  • translated blocks
  • title in blocks

So I wanted to link this thread.
Hope I could help a bit, I do not understand everything yet...

Hanpersand’s picture

What's the status of this? Is that patch getting added back into Panels? Just wondering.

jhuon’s picture

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.

merlinofchaos’s picture

Status: Needs review » Fixed

I'm pretty sure the latest CTools has this all fixed; at least, it seems to now work in my testing.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

RogerRogers’s picture

Just FYI, I had to apply this patch to the latest ctool dev release that I pulled today.

gavin.hughes’s picture

Issue summary: View changes
Status: Closed (fixed) » Active
FileSize
747 bytes

I think this issue is still active, I had to apply patch against 7.x-3.3, and patch works! although I did make a change to the patch to use a relative path, so i'v attached that.

kenorb’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 12: 1505224-12-blocks_titles_are_dumb.patch, failed testing.

The last submitted patch, 3: blocks_titles_are_dumb-1505224-3.patch, failed testing.

andrewmacpherson’s picture

Project: Panels » Ctools
Version: 7.x-3.2 »
Component: Miscellaneous » Code
Status: Needs work » Needs review

Not sure why this patch was in the Panels issue queue - it actually changes a file in ctools.
Moving to correct project, re-setting to needs review.

andrewmacpherson’s picture

For some reason I can't select the version.
Patch applies cleanly to ctools-7.x-1.7

drumm’s picture

Project: Ctools » Chaos Tool Suite (ctools)
Version: » 7.x-1.x-dev
jenlampton’s picture

Title: When adding "Custom Blocks" then Block Title is not fetched » When adding "Custom Blocks" to panels the Block Title is not fetched

Patch in #12 still applies cleanly to ctools 7.x-1.9.

Chris Matthews’s picture

The 5 year old patch in #12 to block.inc applied cleanly to the latest ctools 7.x-1.x-dev and (if still applicable) needs review.

Checking patch plugins/content_types/block/block.inc...
Hunk #1 succeeded at 482 (offset -52 lines).
Applied patch plugins/content_types/block/block.inc cleanly.