public function TestThemeNegotiator::determineActiveTheme in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/menu_test/src/Theme/TestThemeNegotiator.php \Drupal\menu_test\Theme\TestThemeNegotiator::determineActiveTheme()
- 9 core/modules/system/tests/modules/menu_test/src/Theme/TestThemeNegotiator.php \Drupal\menu_test\Theme\TestThemeNegotiator::determineActiveTheme()
Determine the active theme for the request.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match object.
Return value
string|null The name of the theme, or NULL if other negotiators, like the configured default one, should be used instead.
Overrides ThemeNegotiatorInterface::determineActiveTheme
File
- core/
modules/ system/ tests/ modules/ menu_test/ src/ Theme/ TestThemeNegotiator.php, line 26
Class
- TestThemeNegotiator
- Tests the theme negotiation functionality.
Namespace
Drupal\menu_test\ThemeCode
public function determineActiveTheme(RouteMatchInterface $route_match) {
$argument = $route_match
->getParameter('inherited');
// Test using the variable administrative theme.
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';
}
// For any other value of the URL argument, do not return anything. This
// allows us to test that returning nothing from a theme negotiation
// causes the page to correctly fall back on using the main site theme.
}