public function ThemeNegotiator::determineActiveTheme in Drupal 9
Same name and namespace in other branches
- 8 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 The name of the theme, or NULL if other negotiators, like the configured default one, should be used instead.
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\ThemeCode
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;
      }
    }
  }
}