function ThemeHandler::setDefault
Overrides ThemeHandlerInterface::setDefault
File
-
core/
lib/ Drupal/ Core/ Extension/ ThemeHandler.php, line 68
Class
- ThemeHandler
- Default theme handler using the config system to store installation statuses.
Namespace
Drupal\Core\ExtensionCode
public function setDefault($name) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:8.2.0 and is removed from drupal:9.0.0. Use the configuration system to edit the system.theme config directly. See https://www.drupal.org/node/3082630', E_USER_DEPRECATED);
$list = $this->listInfo();
if (!isset($list[$name])) {
throw new UninstalledExtensionException("{$name} theme is not installed.");
}
$this->configFactory
->getEditable('system.theme')
->set('default', $name)
->save();
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.