TestThemeNegotiator.php in Drupal 9
File
core/modules/system/tests/modules/menu_test/src/Theme/TestThemeNegotiator.php
View source
<?php
namespace Drupal\menu_test\Theme;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Theme\ThemeNegotiatorInterface;
class TestThemeNegotiator implements ThemeNegotiatorInterface {
public function applies(RouteMatchInterface $route_match) {
return (bool) $route_match
->getParameter('inherited');
}
public function determineActiveTheme(RouteMatchInterface $route_match) {
$argument = $route_match
->getParameter('inherited');
if ($argument == 'use-admin-theme') {
return \Drupal::config('system.theme')
->get('admin');
}
elseif ($argument == 'use-test-theme') {
return 'test_theme';
}
elseif ($argument == 'use-fake-theme') {
return 'fake_theme';
}
}
}