diff --git a/core/modules/block/block.install b/core/modules/block/block.install index f473c23..e165f91 100644 --- a/core/modules/block/block.install +++ b/core/modules/block/block.install @@ -12,16 +12,16 @@ /** * Update block visibility context mapping. - * - * This update function updates blocks for the change of - * https://www.drupal.org/node/2354889 - * - * Core visibility context plugins are updated automatically; blocks with - * unknown plugins are disabled and their previous visibility settings are saved - * in key value storage; see change record https://www.drupal.org/node/2527840 - * for more explanation. */ function block_update_8001() { + // This update function updates blocks for the change of + // https://www.drupal.org/node/2354889 + // + // Core visibility context plugins are updated automatically; blocks with + // unknown plugins are disabled and their previous visibility settings are saved + // in key value storage; see change record https://www.drupal.org/node/2527840 + // for more explanation. + // These 3 are all the contexts that Drupal core provides. $context_service_id_map = [ 'language' => 'language.current_language_context', @@ -94,27 +94,15 @@ function block_update_8001() { \Drupal::keyValue('update_backup')->set('block_update_8001', $update_backup); } - if ($disabled_blocks) { - $message = \Drupal::translation()->translate('Encountered a context mapping key coming probably from a contributed or custom module: One or more mappings could not be updated. Please manually review your visibility settings for the following blocks, which are disabled now:'); - $message .= ''; - } - return $message; } /** * Disables all blocks which had missing context mappings. - * - * Note: For this update function its fine to use the entity API, see the - * explanation in block_update_8001(). - * - * @see block_update_8001() */ function block_update_8002() { + // Note: For this update function its fine to use the entity API, see the + // explanation in block_update_8001(). $block_update_8001 = \Drupal::keyValue('update_backup')->get('block_update_8001', []); $block_storage = \Drupal::entityManager()->getStorage('block'); @@ -126,6 +114,22 @@ function block_update_8002() { $block->setStatus(FALSE); $block->save(); } + + if (count($blocks) > 0) { + $message = \Drupal::translation() + ->translate('Encountered a context mapping key coming probably from a contributed or custom module: One or more mappings could not be updated. Please manually review your visibility settings for the following blocks, which are disabled now:'); + $message .= ''; + + return $message; + } } /**