You are here

function thunder_update_8126 in Thunder 8.2

Install seven theme.

In preparation of a thunder_admin theme stable release which will use seven as a base theme.

File

./thunder.install, line 981
Install, update and uninstall functions for the thunder installation profile.

Code

function thunder_update_8126() {

  /** @var \Drupal\update_helper\Updater $updater */
  $updater = \Drupal::service('update_helper.updater');
  $updateLogger = $updater
    ->logger();

  /** @var \Drupal\Core\Extension\ThemeInstallerInterface $themeInstaller */
  $themeInstaller = \Drupal::service('theme_installer');

  // Get installed themes.
  $installedThemes = \Drupal::configFactory()
    ->getEditable('core.extension')
    ->get('theme') ?: [];
  if (array_key_exists('seven', $installedThemes)) {
    $updateLogger
      ->info('Theme "seven" has already been installed.');
    _thunder_mark_update_checklist('thunder__thunder_update_8125', TRUE, $updateLogger);
  }
  elseif ($themeInstaller
    ->install([
    'seven',
  ])) {
    $updateLogger
      ->info('Theme "seven" successfully installed.');
    _thunder_mark_update_checklist('thunder__thunder_update_8125', TRUE, $updateLogger);
  }
  else {
    $updateLogger
      ->warning('Theme "seven" not installed.');
    _thunder_mark_update_checklist('thunder__thunder_update_8125', FALSE, $updateLogger);
  }

  // Output logged result of update hook execution.
  return $updateLogger
    ->output();
}