commit fac4e11e81f0d14e894047e3cfe3fb8bd9096b02 Author: Matthew Radcliffe Date: Wed May 22 23:41:48 2013 -0700 Issue #1871700 by mradcliffe: Fix labels not upgrading and added tests. diff --git a/core/includes/update.inc b/core/includes/update.inc index 8fb6ca2..ae22191 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -1599,7 +1599,7 @@ function update_add_cache_columns($table) { } /** - * + * Create block config entity from properties passed in by module. * * @param $block_name * The full name of the block including block prefix (block.block). @@ -1617,12 +1617,9 @@ function update_block_to_config($block_name, $module, $delta, $properties) { // Set default properties. $defaults = array( 'id' => '', - 'label' => '', - 'label_display' => 'visible', 'uuid' => '', 'region' => '', 'weight' => 0, - 'module' => '', 'status' => 0, 'visibility' => array( 'path' => array( @@ -1639,6 +1636,9 @@ function update_block_to_config($block_name, $module, $delta, $properties) { ), 'plugin' => '', 'settings' => array( + 'label' => '', + 'label_display' => 'visible', + 'module' => '', 'cache' => -1, ), ); diff --git a/core/modules/menu/menu.install b/core/modules/menu/menu.install index 67ba008..cf18bb9 100644 --- a/core/modules/menu/menu.install +++ b/core/modules/menu/menu.install @@ -112,7 +112,6 @@ function menu_update_8005() { $properties = array( 'id' => $block->theme . '.' . $block->delta, 'plugin' => 'menu_menu_block:' . $block->delta, - 'label' => $block->title, 'weight' => $block->weight, 'status' => $block->status, 'region' => $block->region, @@ -124,7 +123,7 @@ function menu_update_8005() { ), 'settings' => array( 'cache' => $block->cache, - 'admin_label' => $block->title, + 'label' => $block->title, ), ); $ret = update_block_to_config($block_name, 'menu', $block->delta, $properties); diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php index 45f2efb..48283d7 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php @@ -24,7 +24,7 @@ public static function getInfo() { public function setUp() { $this->databaseDumpFiles = array( - drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.minimal.database.php.gz', + drupal_get_path('module', 'system') . '/tests/upgrade/drupal-7.bare.standard_all.database.php.gz', ); parent::setUp(); } @@ -60,6 +60,16 @@ public function testBlockUpgradeTitleLength() { // Confirm that the custom block cannot be created with title longer than // the maximum number of characters. $this->assertText('Title cannot be longer than 255 characters'); + + // Change an upgraded block. + $edit = array( + 'settings[label]' => $this->randomName(50), + ); + $this->drupalPost('admin/structure/block/manage/bartik.login/configure', $edit, t('Save block')); + $this->drupalLogout(); + $this->drupalGet(''); + $this->assertText($edit['settings[label]'], 'Bartik user login block title successfully changed.'); + } } diff --git a/core/modules/user/user.install b/core/modules/user/user.install index d48e960..671fbea 100644 --- a/core/modules/user/user.install +++ b/core/modules/user/user.install @@ -1068,7 +1068,6 @@ function user_update_8018() { $properties = array( 'id' => $block->theme . '.' . $block->delta, 'plugin' => 'user_' . $block->delta . '_block', - 'label' => $block->title, 'weight' => $block->weight, 'status' => $block->status, 'region' => $block->region, @@ -1080,6 +1079,7 @@ function user_update_8018() { ), 'settings' => array( 'cache' => $block->cache, + 'label' => $block->title, ), ); $ret = update_block_to_config($block_name, 'user', $block->delta, $properties);