1<?php
2
3namespace Drupal\theme_test\Theme;
4
5use Drupal\Core\Routing\RouteMatchInterface;
6use Drupal\Core\Theme\ThemeNegotiatorInterface;
7
8/**
9 * Just forces the 'test_theme' theme.
10 */
11class CustomThemeNegotiator implements ThemeNegotiatorInterface {
12
13  /**
14   * {@inheritdoc}
15   */
16  public function applies(RouteMatchInterface $route_match) {
17    $route = $route_match->getRouteObject();
18    return ($route && $route->hasOption('_custom_theme'));
19  }
20
21  /**
22   * {@inheritdoc}
23   */
24  public function determineActiveTheme(RouteMatchInterface $route_match) {
25    return $route_match->getRouteObject()->getOption('_custom_theme');
26  }
27
28}
29