You are here

class CustomThemeNegotiator in Drupal 8

Same name and namespace in other branches
  1. 9 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

Namesort descending Modifiers Type Description Overrides
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