batchStorage = $batch_storage; $this->requestStack = $request_stack; } /** * {@inheritdoc} */ public function applies(RouteMatchInterface $route_match) { return $route_match->getRouteName() == 'system.batch_page'; } /** * {@inheritdoc} */ 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']; } } }