Issue #1103590 by dcrocks: Fixed blocks being added to 'hidden' region when theme first enabled.

8.0.x
webchick 2011-07-03 10:57:21 -07:00
parent faf72e104e
commit a962791dbe
1 changed files with 2 additions and 1 deletions

View File

@ -612,7 +612,8 @@ function block_theme_initialize($theme) {
$has_blocks = (bool) db_query_range('SELECT 1 FROM {block} WHERE theme = :theme', 0, 1, array(':theme' => $theme))->fetchField();
if (!$has_blocks) {
$default_theme = variable_get('theme_default', 'bartik');
$regions = system_region_list($theme);
// Apply only to new theme's visible regions.
$regions = system_region_list($theme, REGIONS_VISIBLE);
$result = db_query("SELECT * FROM {block} WHERE theme = :theme", array(':theme' => $default_theme), array('fetch' => PDO::FETCH_ASSOC));
foreach ($result as $block) {
// If the region isn't supported by the theme, assign the block to the theme's default region.