class CustomThemeNegotiator

Same name and namespace in other branches
  1. 8.9.x core/modules/system/tests/modules/theme_test/src/Theme/CustomThemeNegotiator.php \Drupal\theme_test\Theme\CustomThemeNegotiator
  2. 10 core/modules/system/tests/modules/theme_test/src/Theme/CustomThemeNegotiator.php \Drupal\theme_test\Theme\CustomThemeNegotiator
  3. 11.x core/modules/system/tests/modules/theme_test/src/Theme/CustomThemeNegotiator.php \Drupal\theme_test\Theme\CustomThemeNegotiator

Just forces the 'test_theme' theme.

Hierarchy

Expanded class hierarchy of CustomThemeNegotiator

1 string reference to 'CustomThemeNegotiator'
theme_test.services.yml in core/modules/system/tests/modules/theme_test/theme_test.services.yml
core/modules/system/tests/modules/theme_test/theme_test.services.yml
1 service uses CustomThemeNegotiator
theme.negotiator.test_custom_theme in core/modules/system/tests/modules/theme_test/theme_test.services.yml
Drupal\theme_test\Theme\CustomThemeNegotiator

File

core/modules/system/tests/modules/theme_test/src/Theme/CustomThemeNegotiator.php, line 11

Namespace

Drupal\theme_test\Theme
View source
class CustomThemeNegotiator implements ThemeNegotiatorInterface {
    
    /**
     * {@inheritdoc}
     */
    public function applies(RouteMatchInterface $route_match) {
        $route = $route_match->getRouteObject();
        return $route && $route->hasOption('_custom_theme');
    }
    
    /**
     * {@inheritdoc}
     */
    public function determineActiveTheme(RouteMatchInterface $route_match) {
        return $route_match->getRouteObject()
            ->getOption('_custom_theme');
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
CustomThemeNegotiator::applies public function Whether this theme negotiator should be used to set the theme. Overrides ThemeNegotiatorInterface::applies
CustomThemeNegotiator::determineActiveTheme public function Determine the active theme for the request. Overrides ThemeNegotiatorInterface::determineActiveTheme

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