1 system.install system_update_1060()

Remove the homepage breadcrumb block.

Related topics

File

core/modules/system/system.install, line 3037
Install, update and uninstall functions for the system module.

Code

function system_update_1060() {
  $config = config('layout.layout.home');
  // Only apply this update if the config file already exists.
  if (!$config->isNew()) {
    $positions = $config->get('positions');
    $content = $config->get('content');
    foreach ($content as $uuid => $block_config) {
      // If the breadcrumb block is found and in the top region, remove it.
      if ($block_config['plugin'] === 'system:breadcrumb') {
        if (in_array($uuid, $positions['top'])) {
          unset($content[$uuid]);
          $positions['top'] = array_diff($positions['top'], array($uuid));
          $config->set('positions', $positions);
          $config->set('content', $content);
          $config->save();
        }
        break;
      }
    }
  }
}