Skip to content Skip to navigation

Error when creating a new theme in an existing site

Posted by: 

Each enabled theme in a site will have independent configurations for all of the site blocks.

When a theme is created, the configurations for all of the blocks associated with the default theme will be duplicated for the new theme. However the title text and styles for some of the blocks will be missing the title. In our case the tag and block title was missing for all or our right hand sidebars. They were there for the original default theme but not for the new theme.

Problem described here --

Steps that produced this bug:
1) At admin/build/theme switched from theme 1 to theme 2: disabled theme 1, checked enable and default on theme 2.
2) Clicked save, saw custom blocks that were enabled in theme 1 active in $left and $right that were not displaying the data from the Block Title field
3) At admin/build/block clicked "configure" on one of the custom blocks that was missing its title
4) Confirmed that the block title text was still in the appropriate field, clicked "save" without making any changes.
5) Confirmed that the saved block's title now appeared in the theme where as the untouched block was still missing its title.

Enabling and making theme 1 default again (while disabling theme 2), and then switching in the same fashion back into theme 2 showed the saved block with title whereas the untouched block still did not have a title. It was as though the title only "registered" after the block was saved in that theme. The title would stick no matter what after it was saved within the theme in use.

The bug has been around since D5

The problem can be avoided by applying the patch from shown below

? system_521668.patch
Index: modules/system/system.module
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.585.2.55
diff -u -p -r1.585.2.55 system.module
--- modules/system/system.module 11 Aug 2010 21:10:41 -0000 1.585.2.55
+++ modules/system/system.module 12 Aug 2010 20:14:20 -0000
@@ -1053,8 +1053,8 @@ function system_initialize_theme_blocks(
if (!array_key_exists($block['region'], $regions)) {
$block['region'] = system_default_region($theme);
- db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, visibility, pages, custom, throttle, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', %d, '%s', %d, %d, %d)",
- $block['module'], $block['delta'], $theme, $block['status'], $block['weight'], $block['region'], $block['visibility'], $block['pages'], $block['custom'], $block['throttle'], $block['cache']);
+ db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, visibility, pages, custom, throttle, cache, title) VALUES ('%s', '%s', '%s', %d, %d, '%s', %d, '%s', %d, %d, %d, '%s')",
+ $block['module'], $block['delta'], $theme, $block['status'], $block['weight'], $block['region'], $block['visibility'], $block['pages'], $block['custom'], $block['throttle'], $block['cache'], $block['title']);

After the patch is applied new themes will inherit theme/block configurations correctly