DefaultNegotiator.php 960 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace Drupal\Core\Theme;
  3. use Drupal\Core\Config\ConfigFactoryInterface;
  4. use Drupal\Core\Routing\RouteMatchInterface;
  5. /**
  6. * Determines the default theme of the site.
  7. */
  8. class DefaultNegotiator implements ThemeNegotiatorInterface {
  9. /**
  10. * The system theme config object.
  11. *
  12. * @var \Drupal\Core\Config\ConfigFactoryInterface
  13. */
  14. protected $configFactory;
  15. /**
  16. * Constructs a DefaultNegotiator object.
  17. *
  18. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
  19. * The config factory.
  20. */
  21. public function __construct(ConfigFactoryInterface $config_factory) {
  22. $this->configFactory = $config_factory;
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function applies(RouteMatchInterface $route_match) {
  28. return TRUE;
  29. }
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public function determineActiveTheme(RouteMatchInterface $route_match) {
  34. return $this->configFactory->get('system.theme')->get('default');
  35. }
  36. }