ThemeHandler::setDefault
public function ThemeHandler::setDefault
public ThemeHandler::setDefault($name)
Sets a new default theme.
Parameters
string $theme: The new default theme.
Return value
$this
Overrides ThemeHandlerInterface::setDefault
File
- core/lib/Drupal/Core/Extension/ThemeHandler.php, line 147
Class
- ThemeHandler
- Default theme handler using the config system to store installation statuses.
Namespace
Drupal\Core\ExtensionCode
public function setDefault($name) { $list = $this->listInfo(); if (!isset($list[$name])) { throw new \InvalidArgumentException("$name theme is not installed."); } $this->configFactory->getEditable('system.theme') ->set('default', $name) ->save(); return $this; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!ThemeHandler.php/function/ThemeHandler::setDefault/8.1.x