function TestThemeNegotiator::determineActiveTheme

Same name in other branches
  1. 9 core/modules/system/tests/modules/menu_test/src/Theme/TestThemeNegotiator.php \Drupal\menu_test\Theme\TestThemeNegotiator::determineActiveTheme()
  2. 8.9.x core/modules/system/tests/modules/menu_test/src/Theme/TestThemeNegotiator.php \Drupal\menu_test\Theme\TestThemeNegotiator::determineActiveTheme()
  3. 10 core/modules/system/tests/modules/menu_test/src/Theme/TestThemeNegotiator.php \Drupal\menu_test\Theme\TestThemeNegotiator::determineActiveTheme()

Overrides ThemeNegotiatorInterface::determineActiveTheme

File

core/modules/system/tests/modules/menu_test/src/Theme/TestThemeNegotiator.php, line 28

Class

TestThemeNegotiator
Tests the theme negotiation functionality.

Namespace

Drupal\menu_test\Theme

Code

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.
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.