Mercurial > hg > isophonics-drupal-site
comparison core/modules/user/src/Theme/AdminNegotiator.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\user\Theme; | 3 namespace Drupal\user\Theme; |
4 | 4 |
5 use Drupal\Core\Config\ConfigFactoryInterface; | 5 use Drupal\Core\Config\ConfigFactoryInterface; |
6 use Drupal\Core\Entity\EntityManagerInterface; | 6 use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait; |
7 use Drupal\Core\Entity\EntityTypeManagerInterface; | |
7 use Drupal\Core\Routing\AdminContext; | 8 use Drupal\Core\Routing\AdminContext; |
8 use Drupal\Core\Routing\RouteMatchInterface; | 9 use Drupal\Core\Routing\RouteMatchInterface; |
9 use Drupal\Core\Session\AccountInterface; | 10 use Drupal\Core\Session\AccountInterface; |
10 use Drupal\Core\Theme\ThemeNegotiatorInterface; | 11 use Drupal\Core\Theme\ThemeNegotiatorInterface; |
11 | 12 |
12 /** | 13 /** |
13 * Sets the active theme on admin pages. | 14 * Sets the active theme on admin pages. |
14 */ | 15 */ |
15 class AdminNegotiator implements ThemeNegotiatorInterface { | 16 class AdminNegotiator implements ThemeNegotiatorInterface { |
17 use DeprecatedServicePropertyTrait; | |
18 | |
19 /** | |
20 * {@inheritdoc} | |
21 */ | |
22 protected $deprecatedProperties = ['entityManager' => 'entity.manager']; | |
16 | 23 |
17 /** | 24 /** |
18 * The current user. | 25 * The current user. |
19 * | 26 * |
20 * @var \Drupal\Core\Session\AccountInterface | 27 * @var \Drupal\Core\Session\AccountInterface |
27 * @var \Drupal\Core\Config\ConfigFactoryInterface | 34 * @var \Drupal\Core\Config\ConfigFactoryInterface |
28 */ | 35 */ |
29 protected $configFactory; | 36 protected $configFactory; |
30 | 37 |
31 /** | 38 /** |
32 * The entity manager. | 39 * The entity type manager. |
33 * | 40 * |
34 * @var \Drupal\Core\Entity\EntityManagerInterface | 41 * @var \Drupal\Core\Entity\EntityTypeManagerInterface |
35 */ | 42 */ |
36 protected $entityManager; | 43 protected $entityTypeManager; |
37 | 44 |
38 /** | 45 /** |
39 * The route admin context to determine whether a route is an admin one. | 46 * The route admin context to determine whether a route is an admin one. |
40 * | 47 * |
41 * @var \Drupal\Core\Routing\AdminContext | 48 * @var \Drupal\Core\Routing\AdminContext |
47 * | 54 * |
48 * @param \Drupal\Core\Session\AccountInterface $user | 55 * @param \Drupal\Core\Session\AccountInterface $user |
49 * The current user. | 56 * The current user. |
50 * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory | 57 * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory |
51 * The config factory. | 58 * The config factory. |
52 * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager | 59 * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager |
53 * The entity manager. | 60 * The entity type manager. |
54 * @param \Drupal\Core\Routing\AdminContext $admin_context | 61 * @param \Drupal\Core\Routing\AdminContext $admin_context |
55 * The route admin context to determine whether the route is an admin one. | 62 * The route admin context to determine whether the route is an admin one. |
56 */ | 63 */ |
57 public function __construct(AccountInterface $user, ConfigFactoryInterface $config_factory, EntityManagerInterface $entity_manager, AdminContext $admin_context) { | 64 public function __construct(AccountInterface $user, ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, AdminContext $admin_context) { |
58 $this->user = $user; | 65 $this->user = $user; |
59 $this->configFactory = $config_factory; | 66 $this->configFactory = $config_factory; |
60 $this->entityManager = $entity_manager; | 67 $this->entityTypeManager = $entity_type_manager; |
61 $this->adminContext = $admin_context; | 68 $this->adminContext = $admin_context; |
62 } | 69 } |
63 | 70 |
64 /** | 71 /** |
65 * {@inheritdoc} | 72 * {@inheritdoc} |
66 */ | 73 */ |
67 public function applies(RouteMatchInterface $route_match) { | 74 public function applies(RouteMatchInterface $route_match) { |
68 return ($this->entityManager->hasHandler('user_role', 'storage') && $this->user->hasPermission('view the administration theme') && $this->adminContext->isAdminRoute($route_match->getRouteObject())); | 75 return ($this->entityTypeManager->hasHandler('user_role', 'storage') && $this->user->hasPermission('view the administration theme') && $this->adminContext->isAdminRoute($route_match->getRouteObject())); |
69 } | 76 } |
70 | 77 |
71 /** | 78 /** |
72 * {@inheritdoc} | 79 * {@inheritdoc} |
73 */ | 80 */ |