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\Extension
Code
1 2 3 4 5 6 7 8 9 10 | 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 ; } |
Please login to continue.