You are here

public function ThemeNegotiator::determineActiveTheme in Visually Impaired Support (module) 8

Determine the active theme for the request.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match object.

Return value

string|null The name of the theme, or NULL if other negotiators, like the configured default one, should be used instead.

Overrides ThemeNegotiatorInterface::determineActiveTheme

File

src/Theme/ThemeNegotiator.php, line 54

Class

ThemeNegotiator
Defines the theme negotiator.

Namespace

Drupal\visually_impaired_module\Theme

Code

public function determineActiveTheme(RouteMatchInterface $route_match) {
  $config = $this->configFactory
    ->get('visually_impaired_module.visually_impaired_module.settings');
  $is_admin = $this->routerAdminContext
    ->isAdminRoute($route_match
    ->getRouteObject());
  if (isset($_COOKIE['visually_impaired']) && $_COOKIE['visually_impaired'] == 'on' && $is_admin == FALSE) {
    return $config
      ->get('visually_impaired_theme');
  }
}