block.post_update.php in Drupal 9
Same filename and directory in other branches
Post update functions for Block.
File
core/modules/block/block.post_update.phpView source
<?php
/**
* @file
* Post update functions for Block.
*/
/**
* Implements hook_removed_post_updates().
*/
function block_removed_post_updates() {
return [
'block_post_update_disable_blocks_with_missing_contexts' => '9.0.0',
'block_post_update_disabled_region_update' => '9.0.0',
'block_post_update_fix_negate_in_conditions' => '9.0.0',
];
}
/**
* Updates the node type visibility condition.
*/
function block_post_update_replace_node_type_condition() {
$config_factory = \Drupal::configFactory();
foreach ($config_factory
->listAll('block.block.') as $block_config_name) {
$block = $config_factory
->getEditable($block_config_name);
if ($block
->get('visibility.node_type')) {
$configuration = $block
->get('visibility.node_type');
$configuration['id'] = 'entity_bundle:node';
$block
->set('visibility.entity_bundle:node', $configuration);
$block
->clear('visibility.node_type');
$block
->save(TRUE);
}
}
}
Functions
Name | Description |
---|---|
block_post_update_replace_node_type_condition | Updates the node type visibility condition. |
block_removed_post_updates | Implements hook_removed_post_updates(). |