public function BatchNegotiator::determineActiveTheme in Drupal 8
Same name and namespace in other branches
- 9 core/modules/system/src/Theme/BatchNegotiator.php \Drupal\system\Theme\BatchNegotiator::determineActiveTheme()
- 10 core/modules/system/src/Theme/BatchNegotiator.php \Drupal\system\Theme\BatchNegotiator::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/ src/ Theme/ BatchNegotiator.php, line 52
Class
- BatchNegotiator
- Sets the active theme for the batch page.
Namespace
Drupal\system\ThemeCode
public function determineActiveTheme(RouteMatchInterface $route_match) {
// Retrieve the current state of the batch.
$request = $this->requestStack
->getCurrentRequest();
$batch =& batch_get();
if (!$batch && $request->request
->has('id')) {
$batch = $this->batchStorage
->load($request->request
->get('id'));
}
// Use the same theme as the page that started the batch.
if (!empty($batch['theme'])) {
return $batch['theme'];
}
}