class AdminNegotiator implements ThemeNegotiatorInterface (View source)

Sets the active theme on admin pages.

Properties

protected AccountInterface $user

The current user.

protected ConfigFactoryInterface $configFactory

The config factory.

protected EntityTypeManagerInterface $entityTypeManager

The entity type manager.

protected AdminContext $adminContext

The route admin context to determine whether a route is an admin one.

Methods

__construct(AccountInterface $user, ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, AdminContext $admin_context)

Creates a new AdminNegotiator instance.

bool
applies(RouteMatchInterface $route_match)

Whether this theme negotiator should be used to set the theme.

string|null
determineActiveTheme(RouteMatchInterface $route_match)

Determine the active theme for the request.

Details

__construct(AccountInterface $user, ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, AdminContext $admin_context)

Creates a new AdminNegotiator instance.

Parameters

AccountInterface $user

The current user.

ConfigFactoryInterface $config_factory

The config factory.

EntityTypeManagerInterface $entity_type_manager

The entity type manager.

AdminContext $admin_context

The route admin context to determine whether the route is an admin one.

bool applies(RouteMatchInterface $route_match)

Whether this theme negotiator should be used to set the theme.

Parameters

RouteMatchInterface $route_match

The current route match object.

Return Value

bool

TRUE if this negotiator should be used or FALSE to let other negotiators decide.

string|null determineActiveTheme(RouteMatchInterface $route_match)

Determine the active theme for the request.

Parameters

RouteMatchInterface $route_match

The current route match object.

Return Value

string|null

The name of the theme, or NULL if other negotiators, like the configured default one, should be used instead.