function AdminNegotiator::__construct
Same name in other branches
- 9 core/modules/user/src/Theme/AdminNegotiator.php \Drupal\user\Theme\AdminNegotiator::__construct()
- 8.9.x core/modules/user/src/Theme/AdminNegotiator.php \Drupal\user\Theme\AdminNegotiator::__construct()
- 10 core/modules/user/src/Theme/AdminNegotiator.php \Drupal\user\Theme\AdminNegotiator::__construct()
Creates a new AdminNegotiator instance.
Parameters
\Drupal\Core\Session\AccountInterface $user: The current user.
\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory.
\Drupal\Core\Routing\AdminContext|EntityTypeManagerInterface $admin_context: The route admin context to determine whether the route is an admin one.
File
-
core/
modules/ user/ src/ Theme/ AdminNegotiator.php, line 55
Class
- AdminNegotiator
- Sets the active theme on admin pages.
Namespace
Drupal\user\ThemeCode
public function __construct(AccountInterface $user, ConfigFactoryInterface $config_factory, AdminContext|EntityTypeManagerInterface $admin_context) {
$this->user = $user;
$this->configFactory = $config_factory;
if ($admin_context instanceof EntityTypeManagerInterface) {
$deprecated_service_name = EntityTypeManagerInterface::class;
@trigger_error("Passing the {$deprecated_service_name} (entity_type.manager service) to AdminNegotiator is deprecated in drupal:11.2.0 and will be removed in drupal:12.0.0. There is no replacement for this service, as it is not used. See https://www.drupal.org/project/drupal/issues/3501727", E_USER_DEPRECATED);
$this->adminContext = \Drupal::service('router.admin_context');
}
else {
$this->adminContext = $admin_context;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.