You are here

public function TestThemeNegotiator::determineActiveTheme in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 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 Returns the active theme name, else return NULL.

Overrides ThemeNegotiatorInterface::determineActiveTheme

File

core/modules/system/tests/modules/menu_test/src/Theme/TestThemeNegotiator.php, line 31
Contains \Drupal\menu_test\Theme\TestThemeNegotiator.

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