diff --git a/core/modules/block/block.install b/core/modules/block/block.install index 4771eee..3bf0cce 100644 --- a/core/modules/block/block.install +++ b/core/modules/block/block.install @@ -4,7 +4,6 @@ * @file * Install, update, and uninstall functions for the Block module. */ -use Drupal\Core\Cache\Cache; /** * @addtogroup updates-8.0.0-beta @@ -15,7 +14,7 @@ * Update block visibility context mapping. */ function block_update_8001() { - // This update function updates blocks for the change of + // This update function updates blocks for the change from // https://www.drupal.org/node/2354889 // // Core visibility context plugins are updated automatically; blocks with @@ -43,10 +42,8 @@ function block_update_8001() { // be executed before block_update_8002(). /** @var \Drupal\Core\Config\StorageInterface $config_storage */ $config_storage = \Drupal::service('config.storage'); - $message = NULL; - $backup_values = []; + $backup_values = $update_backup = []; - $update_backup = []; foreach ($config_storage->listAll('block.block.') as $block_config_name) { $block = $config_storage->read($block_config_name); if ($visibility = $block['visibility']) { @@ -55,7 +52,7 @@ function block_update_8001() { if (!isset($context_service_id_map[$key])) { // Remove the visibility condition for unknown context mapping // entries, so the update process itself runs through and users can - // fix their block placements manually OR alternatively contrib + // fix their block placements manually OR alternatively contributed // modules can run their own update functions to update mappings // that they provide. $backup_values[] = $context; @@ -71,8 +68,9 @@ function block_update_8001() { $block['visibility'] = $visibility; if ($backup_values) { - // We not only store the missing context mappings but also the - // previous block status so contributed and custom modules could update. + // We not only store the missing context mappings but also the previous + // block status, in order to allow contributed and custom modules to do + // their own updates. $update_backup[$block['id']] = ['missing_context_ids' => $backup_values, 'status' => $block['id']]; } } @@ -83,15 +81,13 @@ function block_update_8001() { if ($update_backup) { \Drupal::keyValue('update_backup')->set('block_update_8001', $update_backup); } - - return $message; } /** - * Disables all blocks from the previous update. + * Disable all blocks from the previous update. */ function block_update_8002() { - // Note: For this update function it's fine to use the entity API; see the + // Note: For this update function it's fine to use the Entity API; see the // explanation in block_update_8001(). $block_update_8001 = \Drupal::keyValue('update_backup')->get('block_update_8001', []); diff --git a/core/modules/block/tests/modules/block_test/src/Plugin/Condition/BaloneySpam.php b/core/modules/block/tests/modules/block_test/src/Plugin/Condition/BaloneySpam.php index 06ecc8a..55e12ab 100644 --- a/core/modules/block/tests/modules/block_test/src/Plugin/Condition/BaloneySpam.php +++ b/core/modules/block/tests/modules/block_test/src/Plugin/Condition/BaloneySpam.php @@ -10,7 +10,7 @@ use Drupal\Core\Condition\ConditionPluginBase; /** - * Provides a 'baloney spam' condition. + * Provides a 'baloney.spam' condition. * * @Condition( * id = "baloney.spam", diff --git a/core/modules/system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php b/core/modules/system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php index d3af4a1..23b67e5 100644 --- a/core/modules/system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php +++ b/core/modules/system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php @@ -10,10 +10,14 @@ $connection = Database::getConnection(); -// Structure of a custom block with visibility settings. - +// A custom block with visibility settings. $block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2354889.yml')); + +// A custom block without any visibility settings. $block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.secondtestfor2354889.yml')); + +// A custom block with visibility settings that contain a non-existing context +// mapping. $block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.thirdtestfor2354889.yml')); foreach ($block_configs as $block_config) {