public function ThemeSwitchNegotiator::applies in Domain Theme Switch 8
Whether this theme negotiator should be used to set the theme.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match object.
Return value
bool TRUE if this negotiator should be used or FALSE to let other negotiators decide.
Overrides ThemeNegotiatorInterface::applies
File
- src/
Theme/ ThemeSwitchNegotiator.php, line 94
Class
- ThemeSwitchNegotiator
- Implements ThemeNegotiatorInterface.
Namespace
Drupal\domain_theme_switch\ThemeCode
public function applies(RouteMatchInterface $route_match) {
if (!($domain = $this->negotiator
->getActiveDomain())) {
// Unable to determine active domain.
return FALSE;
}
$config = $this->configFactory
->get('domain_theme_switch.settings');
// Admin pages uses same theme by default.
$this->defaultTheme = $this->adminTheme = $config
->get($domain
->id() . '_site');
// Allow overriding admin theme for users having 'Use domain admin theme'
// permission.
if ($this->currentUser
->hasPermission('domain administration theme')) {
$this->adminTheme = $config
->get($domain
->id() . '_admin');
}
return TRUE;
}