727e3b72f2ecd58e446b2cdb0c3cde3a704c0cd3
[yaffs-website] / Theme / CustomThemeNegotiator.php
1 <?php
2
3 namespace Drupal\theme_test\Theme;
4
5 use Drupal\Core\Routing\RouteMatchInterface;
6 use Drupal\Core\Theme\ThemeNegotiatorInterface;
7
8 /**
9  * Just forces the 'test_theme' theme.
10  */
11 class 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 }