comparison core/modules/system/src/Theme/DbUpdateNegotiator.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c75dbcec494b
1 <?php
2
3 namespace Drupal\system\Theme;
4
5 use Drupal\Core\Config\ConfigFactoryInterface;
6 use Drupal\Core\Routing\RouteMatchInterface;
7 use Drupal\Core\Site\Settings;
8 use Drupal\Core\Theme\ThemeNegotiatorInterface;
9
10 /**
11 * Sets the active theme for the database update pages.
12 */
13 class DbUpdateNegotiator implements ThemeNegotiatorInterface {
14
15 /**
16 * The config factory.
17 *
18 * @var \Drupal\Core\Config\ConfigFactoryInterface
19 */
20 protected $configFactory;
21
22 /**
23 * Constructs a DbUpdateNegotiator.
24 *
25 * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
26 * The config factory.
27 */
28 public function __construct(ConfigFactoryInterface $config_factory) {
29 $this->configFactory = $config_factory;
30 }
31
32 /**
33 * {@inheritdoc}
34 */
35 public function applies(RouteMatchInterface $route_match) {
36 return $route_match->getRouteName() == 'system.db_update';
37 }
38
39 /**
40 * {@inheritdoc}
41 */
42 public function determineActiveTheme(RouteMatchInterface $route_match) {
43 $custom_theme = Settings::get('maintenance_theme', 'seven');
44 if (!$custom_theme) {
45 $config = $this->configFactory->get('system.theme');
46 $custom_theme = $config->get('default');
47 }
48
49 return $custom_theme;
50 }
51
52 }