class DefaultNegotiator in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Theme/DefaultNegotiator.php \Drupal\Core\Theme\DefaultNegotiator
- 10 core/lib/Drupal/Core/Theme/DefaultNegotiator.php \Drupal\Core\Theme\DefaultNegotiator
Determines the default theme of the site.
Hierarchy
- class \Drupal\Core\Theme\DefaultNegotiator implements ThemeNegotiatorInterface
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
File
- core/
lib/ Drupal/ Core/ Theme/ DefaultNegotiator.php, line 11
Namespace
Drupal\Core\ThemeView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DefaultNegotiator:: |
protected | property | The system theme config object. | |
DefaultNegotiator:: |
public | function |
Whether this theme negotiator should be used to set the theme. Overrides ThemeNegotiatorInterface:: |
|
DefaultNegotiator:: |
public | function |
Determine the active theme for the request. Overrides ThemeNegotiatorInterface:: |
|
DefaultNegotiator:: |
public | function | Constructs a DefaultNegotiator object. |