Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

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.
RSS feed
Powered by Drupal