Chris@0: = 8002 && !\Drupal::state()->get('block_update_8002_placeholder', FALSE)) { Chris@0: return; Chris@0: } Chris@0: Chris@0: // Cleanup the state entry as its no longer needed. Chris@0: \Drupal::state()->delete('block_update_8002'); Chris@0: Chris@0: $block_update_8001 = \Drupal::keyValue('update_backup')->get('block_update_8001', []); Chris@0: Chris@0: $block_ids = array_keys($block_update_8001); Chris@0: $block_storage = \Drupal::entityManager()->getStorage('block'); Chris@0: $blocks = $block_storage->loadMultiple($block_ids); Chris@0: /** @var $blocks \Drupal\block\BlockInterface[] */ Chris@0: foreach ($blocks as $block) { Chris@0: // This block has had conditions removed due to an inability to resolve Chris@0: // contexts in block_update_8001() so disable it. Chris@0: Chris@0: // Disable currently enabled blocks. Chris@0: if ($block_update_8001[$block->id()]['status']) { Chris@0: $block->setStatus(FALSE); Chris@0: $block->save(); Chris@0: } Chris@0: } Chris@0: Chris@0: // Provides a list of plugin labels, keyed by plugin ID. Chris@0: $condition_plugin_id_label_map = array_column(\Drupal::service('plugin.manager.condition')->getDefinitions(), 'label', 'id'); Chris@0: Chris@0: // Override with the UI labels we are aware of. Sadly they are not machine Chris@0: // accessible, see Chris@0: // \Drupal\node\Plugin\Condition\NodeType::buildConfigurationForm(). Chris@0: $condition_plugin_id_label_map['node_type'] = t('Content types'); Chris@0: $condition_plugin_id_label_map['request_path'] = t('Pages'); Chris@0: $condition_plugin_id_label_map['user_role'] = t('Roles'); Chris@0: Chris@0: if (count($block_ids) > 0) { Chris@0: $message = t('Encountered an unknown 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:'); Chris@0: $message .= '