You are here

class DefaultNegotiator in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Theme/DefaultNegotiator.php \Drupal\Core\Theme\DefaultNegotiator
  2. 9 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 \Drupal\Core\Theme\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
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