You are here

function block_update_8003 in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block/block.install \block_update_8003()

Remove 'cache' setting.

File

core/modules/block/block.install, line 108
Contains install and update functions for Block.

Code

function block_update_8003() {
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('block.block.') as $block_config_name) {
    $block = $config_factory
      ->getEditable($block_config_name);

    // Remove the 'cache' setting.
    $settings = $block
      ->get('settings');
    unset($settings['cache']);
    $block
      ->set('settings', $settings);

    // Mark the resulting configuration as trusted data. This avoids issues with
    // future schema changes.
    $block
      ->save(TRUE);
  }
  return t('Block settings updated.');
}