function EntityTypeManager::getRouteProviders

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityTypeManager.php \Drupal\Core\Entity\EntityTypeManager::getRouteProviders()
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityTypeManager.php \Drupal\Core\Entity\EntityTypeManager::getRouteProviders()
  3. 10 core/lib/Drupal/Core/Entity/EntityTypeManager.php \Drupal\Core\Entity\EntityTypeManager::getRouteProviders()

Gets all route provider instances.

Parameters

string $entity_type_id: The entity type ID for the route providers.

Return value

\Drupal\Core\Entity\Routing\EntityRouteProviderInterface[] An array of all the route providers for this entity type.

Overrides EntityTypeManagerInterface::getRouteProviders

File

core/lib/Drupal/Core/Entity/EntityTypeManager.php, line 226

Class

EntityTypeManager
Manages entity type plugin definitions.

Namespace

Drupal\Core\Entity

Code

public function getRouteProviders($entity_type_id) {
  if (!isset($this->handlers['route_provider'][$entity_type_id])) {
    $route_provider_classes = $this->getDefinition($entity_type_id, TRUE)
      ->getRouteProviderClasses();
    foreach ($route_provider_classes as $type => $class) {
      $this->handlers['route_provider'][$entity_type_id][$type] = $this->createHandlerInstance($class, $this->getDefinition($entity_type_id));
    }
  }
  return $this->handlers['route_provider'][$entity_type_id] ?? [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.