final class EdgeEntityFieldConfigListRouteSubscriber in Apigee Edge 8
Replaces the controller on Apigee Edge entities' field config listing UI.
Hierarchy
- class \Drupal\apigee_edge\Routing\EdgeEntityFieldConfigListRouteSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of EdgeEntityFieldConfigListRouteSubscriber
1 string reference to 'EdgeEntityFieldConfigListRouteSubscriber'
1 service uses EdgeEntityFieldConfigListRouteSubscriber
File
- src/
Routing/ EdgeEntityFieldConfigListRouteSubscriber.php, line 33
Namespace
Drupal\apigee_edge\RoutingView source
final class EdgeEntityFieldConfigListRouteSubscriber implements EventSubscriberInterface {
/**
* The entity type manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
private $entityTypeManager;
/**
* AppFieldConfigListUiRouteSubscriber constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager service.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events = [];
$events[RoutingEvents::ALTER] = [
'alterRoutes',
-1024,
];
return $events;
}
/**
* Alters Apigee Edge entity related field config listing UI routes.
*
* @param \Drupal\Core\Routing\RouteBuildEvent $event
* The route build event.
*/
public function alterRoutes(RouteBuildEvent $event) {
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type) {
if (in_array(EdgeEntityInterface::class, class_implements($entity_type
->getOriginalClass())) && ($route = $event
->getRouteCollection()
->get("entity.{$entity_type->id()}.field_ui_fields"))) {
$route
->setDefault('_controller', EdgeEntityFieldConfigListController::class . '::listing');
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EdgeEntityFieldConfigListRouteSubscriber:: |
private | property | The entity type manager service. | |
EdgeEntityFieldConfigListRouteSubscriber:: |
public | function | Alters Apigee Edge entity related field config listing UI routes. | |
EdgeEntityFieldConfigListRouteSubscriber:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
EdgeEntityFieldConfigListRouteSubscriber:: |
public | function | AppFieldConfigListUiRouteSubscriber constructor. |