class DefaultNegotiator

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Theme/DefaultNegotiator.php \Drupal\Core\Theme\DefaultNegotiator
  2. 10 core/lib/Drupal/Core/Theme/DefaultNegotiator.php \Drupal\Core\Theme\DefaultNegotiator
  3. 11.x core/lib/Drupal/Core/Theme/DefaultNegotiator.php \Drupal\Core\Theme\DefaultNegotiator

Determines the default theme of the site.

Hierarchy

Expanded class hierarchy of DefaultNegotiator

1 string reference to 'DefaultNegotiator'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses DefaultNegotiator
theme.negotiator.default in core/core.services.yml
Drupal\Core\Theme\DefaultNegotiator

File

core/lib/Drupal/Core/Theme/DefaultNegotiator.php, line 11

Namespace

Drupal\Core\Theme
View source
class DefaultNegotiator implements ThemeNegotiatorInterface {
    
    /**
     * The system theme config object.
     *
     * @var \Drupal\Core\Config\ConfigFactoryInterface
     */
    protected $configFactory;
    
    /**
     * Constructs a DefaultNegotiator object.
     *
     * @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 TRUE;
    }
    
    /**
     * {@inheritdoc}
     */
    public function determineActiveTheme(RouteMatchInterface $route_match) {
        return $this->configFactory
            ->get('system.theme')
            ->get('default');
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
DefaultNegotiator::$configFactory protected property The system theme config object.
DefaultNegotiator::applies public function Whether this theme negotiator should be used to set the theme. Overrides ThemeNegotiatorInterface::applies
DefaultNegotiator::determineActiveTheme public function Determine the active theme for the request. Overrides ThemeNegotiatorInterface::determineActiveTheme
DefaultNegotiator::__construct public function Constructs a DefaultNegotiator object.

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