Same filename and directory in other branches
- 8.9.x core/modules/system/src/Theme/BatchNegotiator.php
- 9 core/modules/system/src/Theme/BatchNegotiator.php
Namespace
Drupal\system\Theme
File
core/modules/system/src/Theme/BatchNegotiator.php
View source
<?php
namespace Drupal\system\Theme;
use Drupal\Core\Batch\BatchStorageInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Theme\ThemeNegotiatorInterface;
use Symfony\Component\HttpFoundation\RequestStack;
class BatchNegotiator implements ThemeNegotiatorInterface {
protected $batchStorage;
protected $requestStack;
public function __construct(BatchStorageInterface $batch_storage, RequestStack $request_stack) {
$this->batchStorage = $batch_storage;
$this->requestStack = $request_stack;
}
public function applies(RouteMatchInterface $route_match) {
return $route_match
->getRouteName() == 'system.batch_page.html';
}
public function determineActiveTheme(RouteMatchInterface $route_match) {
$request = $this->requestStack
->getCurrentRequest();
$batch =& batch_get();
if (!$batch && $request->request
->has('id')) {
$batch = $this->batchStorage
->load($request->request
->get('id'));
}
if (!empty($batch['theme'])) {
return $batch['theme'];
}
}
}
Classes