function ThemeNegotiator::determineActiveTheme

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Theme/ThemeNegotiator.php \Drupal\Core\Theme\ThemeNegotiator::determineActiveTheme()
  2. 8.9.x core/lib/Drupal/Core/Theme/ThemeNegotiator.php \Drupal\Core\Theme\ThemeNegotiator::determineActiveTheme()
  3. 10 core/lib/Drupal/Core/Theme/ThemeNegotiator.php \Drupal\Core\Theme\ThemeNegotiator::determineActiveTheme()

Overrides ThemeNegotiatorInterface::determineActiveTheme

File

core/lib/Drupal/Core/Theme/ThemeNegotiator.php, line 63

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->negotiators as $negotiator_id) {
        $negotiator = $this->classResolver
            ->getInstanceFromDefinition($negotiator_id);
        if ($negotiator->applies($route_match)) {
            $theme = $negotiator->determineActiveTheme($route_match);
            if ($theme !== NULL && $this->themeAccess
                ->checkAccess($theme)) {
                return $theme;
            }
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.