function BatchNegotiator::determineActiveTheme

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

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\Theme

Code

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'];
    }
}

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