diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php index cb21836..a6baf9f 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -8,14 +8,8 @@ namespace Drupal\Core\Extension; use Drupal\Component\Utility\SafeMarkup; -use Drupal\Core\Asset\AssetCollectionOptimizerInterface; -use Drupal\Core\Cache\Cache; use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Config\ConfigInstallerInterface; -use Drupal\Core\Config\ConfigManagerInterface; -use Drupal\Core\Routing\RouteBuilderInterface; use Drupal\Core\State\StateInterface; -use Psr\Log\LoggerInterface; /** * Default theme handler using the config system to store installation statuses. diff --git a/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php b/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php index 5f3a6cf..5fdceaf 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandlerInterface.php @@ -13,6 +13,50 @@ interface ThemeHandlerInterface { /** + * Installs a given list of themes. + * + * @param array $theme_list + * An array of theme names. + * @param bool $install_dependencies + * (optional) If TRUE, dependencies will automatically be installed in the + * correct order. This incurs a significant performance cost, so use FALSE + * if you know $theme_list is already complete and in the correct order. + * + * @return bool + * Whether any of the given themes have been installed. + * + * @throws \Drupal\Core\Extension\ExtensionNameLengthException + * Thrown when the theme name is to long + * + * @deprecated in Drupal 8.0.x-dev and will be removed before Drupal 9.0.0. + * Use the theme_installer service instead. + * + * @see \Drupal\Core\Extension\ThemeInstallerInterface::install + */ + public function install(array $theme_list, $install_dependencies = TRUE); + + /** + * Uninstalls a given list of themes. + * + * Uninstalling a theme removes all related configuration (like blocks) and + * invokes the 'themes_uninstalled' hook. + * + * @param array $theme_list + * The themes to uninstall. + * + * @throws \InvalidArgumentException + * Thrown when you uninstall an not installed theme. + * + * @see hook_themes_uninstalled() + * + * @deprecated in Drupal 8.0.x-dev and will be removed before Drupal 9.0.0. + * Use the theme_installer service instead. + * + * @see \Drupal\Core\Extension\ThemeInstallerInterface::install + */ + public function uninstall(array $theme_list); + + /** * Returns a list of currently installed themes. * * @return \Drupal\Core\Extension\Extension[] diff --git a/core/lib/Drupal/Core/Extension/ThemeInstaller.php b/core/lib/Drupal/Core/Extension/ThemeInstaller.php index 488264a..1bebca2 100644 --- a/core/lib/Drupal/Core/Extension/ThemeInstaller.php +++ b/core/lib/Drupal/Core/Extension/ThemeInstaller.php @@ -17,6 +17,9 @@ use Drupal\Core\State\StateInterface; use Psr\Log\LoggerInterface; +/** + * Manages theme installation/uninstallation. + */ class ThemeInstaller implements ThemeInstallerInterface { /** @@ -171,10 +174,11 @@ public function install(array $theme_list, $install_dependencies = TRUE) { // configuration then stop installing. $this->configInstaller->checkConfigurationToInstall('theme', $key); - // The value is not used; the weight is ignored for themes currently. + // The value is not used; the weight is ignored for themes currently. Do + // not check schema when saving the configuration. $extension_config ->set("theme.$key", 0) - ->save(); + ->save(TRUE); // Add the theme to the current list. // @todo Remove all code that relies on $status property. @@ -263,7 +267,9 @@ public function uninstall(array $theme_list) { $this->configManager->uninstall('theme', $key); } - $extension_config->save(); + // Don't check schema when uninstalling a theme since we are only clearing + // keys. + $extension_config->save(TRUE); $this->state->set('system.theme.data', $current_theme_data);