You are here

public function ThemeNegotiator::determineActiveTheme in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Theme/ThemeNegotiator.php \Drupal\Core\Theme\ThemeNegotiator::determineActiveTheme()

Determine the active theme for the request.

Parameters

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

Return value

string|null Returns the active theme name, else return NULL.

Overrides ThemeNegotiatorInterface::determineActiveTheme

File

core/lib/Drupal/Core/Theme/ThemeNegotiator.php, line 97
Contains \Drupal\Core\Theme\ThemeNegotiator.

Class

ThemeNegotiator
Provides a class which determines the active theme of the page.

Namespace

Drupal\Core\Theme

Code

public function determineActiveTheme(RouteMatchInterface $route_match) {
  foreach ($this
    ->getSortedNegotiators() as $negotiator) {
    if ($negotiator
      ->applies($route_match)) {
      $theme = $negotiator
        ->determineActiveTheme($route_match);
      if ($theme !== NULL && $this->themeAccess
        ->checkAccess($theme)) {
        return $theme;
      }
    }
  }
}