You are here

function system_update_8014 in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/system.install \system_update_8014()

Install the Stable base theme if needed.

File

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

Code

function system_update_8014() {
  $theme_handler = \Drupal::service('theme_handler');
  if ($theme_handler
    ->themeExists('stable')) {
    return;
  }
  $theme_handler
    ->refreshInfo();
  foreach ($theme_handler
    ->listInfo() as $theme) {

    // We first check that a base theme is set because if it's set to false then
    // it's unset in \Drupal\Core\Extension\ThemeHandler::rebuildThemeData().
    if (isset($theme->info['base theme']) && $theme->info['base theme'] == 'stable') {
      $theme_handler
        ->install([
        'stable',
      ]);
      return;
    }
  }
}