function install_profile_themes

Same name and namespace in other branches
  1. 11.x core/includes/install.core.inc \install_profile_themes()
  2. 10 core/includes/install.core.inc \install_profile_themes()
  3. 9 core/includes/install.core.inc \install_profile_themes()
  4. 8.9.x core/includes/install.core.inc \install_profile_themes()

Installs themes.

This does not use a batch, since installing themes is faster than modules and because an installation profile typically installs 1-3 themes only (default theme, base theme, admin theme).

Parameters

array $install_state: An array of information about the current installation state.

File

core/includes/install.core.inc, line 1694

Code

function install_profile_themes(&$install_state) : void {
  // Install the themes specified by the installation profile.
  $themes = $install_state['profile_info']['themes'];
  // Default theme support is only implemented by the testing framework, to
  // reduce the number of container rebuilds during test runs.
  if (isset($install_state['default_theme'])) {
    $themes = array_unique(array_merge($themes, [
      $install_state['default_theme'],
    ]));
  }
  \Drupal::service('theme_installer')->install($themes);
  // Ensure that the install profile's theme is used.
  // @see _drupal_maintenance_theme()
  \Drupal::theme()->resetActiveTheme();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.