public function WebformThemeManager::setCurrentTheme in Webform 6.x
Same name and namespace in other branches
- 8.5 src/WebformThemeManager.php \Drupal\webform\WebformThemeManager::setCurrentTheme()
Sets the current theme the theme.
Parameters
string $theme_name: (optional) A theme name. Defaults the default theme.
Overrides WebformThemeManagerInterface::setCurrentTheme
2 calls to WebformThemeManager::setCurrentTheme()
- WebformThemeManager::render in src/
WebformThemeManager.php - Renders HTML given a structured array tree.
- WebformThemeManager::renderPlain in src/
WebformThemeManager.php - Renders using the default theme final HTML in situations where no assets are needed.
File
- src/
WebformThemeManager.php, line 152
Class
- WebformThemeManager
- Defines a class to manage webform theming.
Namespace
Drupal\webformCode
public function setCurrentTheme($theme_name = NULL) {
if (!isset($this->activeTheme)) {
$this->activeTheme = $this->themeManager
->getActiveTheme();
}
$current_theme_name = $theme_name ?: $this->configFactory
->get('system.theme')
->get('default');
$current_theme = $this->themeInitialization
->getActiveThemeByName($current_theme_name);
$this->themeManager
->setActiveTheme($current_theme);
}