public function MenuTestController::themePage in Drupal 8
Same name and namespace in other branches
- 9 core/modules/system/tests/modules/menu_test/src/Controller/MenuTestController.php \Drupal\menu_test\Controller\MenuTestController::themePage()
Page callback: Tests the theme negotiation functionality.
Parameters
bool $inherited: TRUE when the requested page is intended to inherit the theme of its parent.
Return value
string A string describing the requested custom theme and actual theme being used for the current page request.
1 string reference to 'MenuTestController::themePage'
- menu_test.routing.yml in core/
modules/ system/ tests/ modules/ menu_test/ menu_test.routing.yml - core/modules/system/tests/modules/menu_test/menu_test.routing.yml
File
- core/
modules/ system/ tests/ modules/ menu_test/ src/ Controller/ MenuTestController.php, line 102
Class
- MenuTestController
- Controller routines for menu_test routes.
Namespace
Drupal\menu_test\ControllerCode
public function themePage($inherited) {
$theme_key = $this->themeManager
->getActiveTheme()
->getName();
// Now we check what the theme negotiator service returns.
$active_theme = $this->themeNegotiator
->determineActiveTheme($this->routeMatch);
$output = "Active theme: {$active_theme}. Actual theme: {$theme_key}.";
if ($inherited) {
$output .= ' Theme negotiation inheritance is being tested.';
}
return [
'#markup' => $output,
];
}