Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176

This commit is contained in:
Pantheon Automation 2015-08-17 17:00:26 -07:00 committed by Greg Anderson
commit 9921556621
13277 changed files with 1459781 additions and 0 deletions

View file

@ -0,0 +1,70 @@
<?php
/**
* @file
* Contains \Drupal\system\Theme\BatchNegotiator.
*/
namespace Drupal\system\Theme;
use Drupal\Core\Batch\BatchStorageInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Theme\ThemeNegotiatorInterface;
use Symfony\Component\HttpFoundation\RequestStack;
/**
* Sets the active theme for the batch page.
*/
class BatchNegotiator implements ThemeNegotiatorInterface {
/**
* The batch storage.
*
* @var \Drupal\Core\Batch\BatchStorageInterface
*/
protected $batchStorage;
/**
* The request stack.
*
* @var \Symfony\Component\HttpFoundation\RequestStack
*/
protected $requestStack;
/**
* Constructs a BatchNegotiator.
*
* @param \Drupal\Core\Batch\BatchStorageInterface $batch_storage
* The batch storage.
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
* The request stack used to retrieve the current request.
*/
public function __construct(BatchStorageInterface $batch_storage, RequestStack $request_stack) {
$this->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'];
}
}
}

View file

@ -0,0 +1,57 @@
<?php
/**
* @file
* Contains \Drupal\system\Theme\DbUpdateNegotiator.
*/
namespace Drupal\system\Theme;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Site\Settings;
use Drupal\Core\Theme\ThemeNegotiatorInterface;
/**
* Sets the active theme for the database update pages.
*/
class DbUpdateNegotiator implements ThemeNegotiatorInterface {
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs a DbUpdateNegotiator.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
public function __construct(ConfigFactoryInterface $config_factory) {
$this->configFactory = $config_factory;
}
/**
* {@inheritdoc}
*/
public function applies(RouteMatchInterface $route_match) {
return $route_match->getRouteName() == 'system.db_update';
}
/**
* {@inheritdoc}
*/
public function determineActiveTheme(RouteMatchInterface $route_match) {
$custom_theme = Settings::get('maintenance_theme', 'seven');
if (!$custom_theme) {
$config = $this->configFactory->get('system.theme');
$custom_theme = $config->get('default');
}
return $custom_theme;
}
}