Chris@0: 'entity.manager']; Chris@0: Chris@0: /** Chris@0: * The current user. Chris@0: * Chris@0: * @var \Drupal\Core\Session\AccountInterface Chris@0: */ Chris@0: protected $user; Chris@0: Chris@0: /** Chris@0: * The config factory. Chris@0: * Chris@0: * @var \Drupal\Core\Config\ConfigFactoryInterface Chris@0: */ Chris@0: protected $configFactory; Chris@0: Chris@0: /** Chris@18: * The entity type manager. Chris@0: * Chris@18: * @var \Drupal\Core\Entity\EntityTypeManagerInterface Chris@0: */ Chris@18: protected $entityTypeManager; Chris@0: Chris@0: /** Chris@0: * The route admin context to determine whether a route is an admin one. Chris@0: * Chris@0: * @var \Drupal\Core\Routing\AdminContext Chris@0: */ Chris@0: protected $adminContext; Chris@0: Chris@0: /** Chris@0: * Creates a new AdminNegotiator instance. Chris@0: * Chris@0: * @param \Drupal\Core\Session\AccountInterface $user Chris@0: * The current user. Chris@0: * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory Chris@0: * The config factory. Chris@18: * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager Chris@18: * The entity type manager. Chris@0: * @param \Drupal\Core\Routing\AdminContext $admin_context Chris@0: * The route admin context to determine whether the route is an admin one. Chris@0: */ Chris@18: public function __construct(AccountInterface $user, ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, AdminContext $admin_context) { Chris@0: $this->user = $user; Chris@0: $this->configFactory = $config_factory; Chris@18: $this->entityTypeManager = $entity_type_manager; Chris@0: $this->adminContext = $admin_context; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function applies(RouteMatchInterface $route_match) { Chris@18: return ($this->entityTypeManager->hasHandler('user_role', 'storage') && $this->user->hasPermission('view the administration theme') && $this->adminContext->isAdminRoute($route_match->getRouteObject())); Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function determineActiveTheme(RouteMatchInterface $route_match) { Chris@0: return $this->configFactory->get('system.theme')->get('admin'); Chris@0: } Chris@0: Chris@0: }