DbUpdateNegotiator.php

Same filename in other branches
  1. 9 core/modules/system/src/Theme/DbUpdateNegotiator.php
  2. 8.9.x core/modules/system/src/Theme/DbUpdateNegotiator.php
  3. 11.x core/modules/system/src/Theme/DbUpdateNegotiator.php

Namespace

Drupal\system\Theme

File

core/modules/system/src/Theme/DbUpdateNegotiator.php

View source
<?php

namespace Drupal\system\Theme;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\Routing\RouteMatchInterface;
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;
    
    /**
     * The theme handler.
     *
     * @var \Drupal\Core\Extension\ThemeHandlerInterface
     */
    protected $themeHandler;
    
    /**
     * Constructs a DbUpdateNegotiator.
     *
     * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
     *   The config factory.
     * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
     *   The theme handler.
     */
    public function __construct(ConfigFactoryInterface $config_factory, ThemeHandlerInterface $theme_handler) {
        $this->configFactory = $config_factory;
        $this->themeHandler = $theme_handler;
    }
    
    /**
     * {@inheritdoc}
     */
    public function applies(RouteMatchInterface $route_match) {
        return $route_match->getRouteName() == 'system.db_update';
    }
    
    /**
     * {@inheritdoc}
     */
    public function determineActiveTheme(RouteMatchInterface $route_match) {
        // The update page always uses Claro to ensure stability.
        return 'claro';
    }

}

Classes

Title Deprecated Summary
DbUpdateNegotiator Sets the active theme for the database update pages.

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