Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/field_ui/src/Routing/RouteSubscriber.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\field_ui\Routing; | 3 namespace Drupal\field_ui\Routing; |
4 | 4 |
5 use Drupal\Core\Entity\EntityManagerInterface; | 5 use Drupal\Core\Entity\EntityTypeManagerInterface; |
6 use Drupal\Core\Routing\RouteSubscriberBase; | 6 use Drupal\Core\Routing\RouteSubscriberBase; |
7 use Drupal\Core\Routing\RoutingEvents; | 7 use Drupal\Core\Routing\RoutingEvents; |
8 use Symfony\Component\Routing\Route; | 8 use Symfony\Component\Routing\Route; |
9 use Symfony\Component\Routing\RouteCollection; | 9 use Symfony\Component\Routing\RouteCollection; |
10 | 10 |
12 * Subscriber for Field UI routes. | 12 * Subscriber for Field UI routes. |
13 */ | 13 */ |
14 class RouteSubscriber extends RouteSubscriberBase { | 14 class RouteSubscriber extends RouteSubscriberBase { |
15 | 15 |
16 /** | 16 /** |
17 * The entity type manager | 17 * The entity type manager service. |
18 * | 18 * |
19 * @var \Drupal\Core\Entity\EntityManagerInterface | 19 * @var \Drupal\Core\Entity\EntityTypeManagerInterface |
20 */ | 20 */ |
21 protected $manager; | 21 protected $entityTypeManager; |
22 | 22 |
23 /** | 23 /** |
24 * Constructs a RouteSubscriber object. | 24 * Constructs a RouteSubscriber object. |
25 * | 25 * |
26 * @param \Drupal\Core\Entity\EntityManagerInterface $manager | 26 * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager |
27 * The entity type manager. | 27 * The entity type manager service. |
28 */ | 28 */ |
29 public function __construct(EntityManagerInterface $manager) { | 29 public function __construct(EntityTypeManagerInterface $entity_type_manager) { |
30 $this->manager = $manager; | 30 $this->entityTypeManager = $entity_type_manager; |
31 } | 31 } |
32 | 32 |
33 /** | 33 /** |
34 * {@inheritdoc} | 34 * {@inheritdoc} |
35 */ | 35 */ |
36 protected function alterRoutes(RouteCollection $collection) { | 36 protected function alterRoutes(RouteCollection $collection) { |
37 foreach ($this->manager->getDefinitions() as $entity_type_id => $entity_type) { | 37 foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) { |
38 if ($route_name = $entity_type->get('field_ui_base_route')) { | 38 if ($route_name = $entity_type->get('field_ui_base_route')) { |
39 // Try to get the route from the current collection. | 39 // Try to get the route from the current collection. |
40 if (!$entity_route = $collection->get($route_name)) { | 40 if (!$entity_route = $collection->get($route_name)) { |
41 continue; | 41 continue; |
42 } | 42 } |