You are here

protected function OgRouteGroupResolverBase::getContentEntityPaths in Organic groups 8

Returns the paths for the link templates of all content entities.

Based on LanguageNegotiationContentEntity::getContentEntityPaths().

Return value

array An array of all content entity type IDs, keyed by the corresponding link template paths.

See also

\Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationContentEntity::getContentEntityPaths()

1 call to OgRouteGroupResolverBase::getContentEntityPaths()
OgRouteGroupResolverBase::getContentEntity in src/OgRouteGroupResolverBase.php
Returns the content entity from the current route.

File

src/OgRouteGroupResolverBase.php, line 118

Class

OgRouteGroupResolverBase
Base class for OgGroupResolver plugins that inspect the route.

Namespace

Drupal\og

Code

protected function getContentEntityPaths() {
  if (!isset($this->contentEntityPaths)) {
    $this->contentEntityPaths = [];

    /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
    $entity_types = $this->entityTypeManager
      ->getDefinitions();
    foreach ($entity_types as $entity_type_id => $entity_type) {
      if ($entity_type
        ->entityClassImplements(ContentEntityInterface::class)) {
        $entity_paths = array_fill_keys($entity_type
          ->getLinkTemplates(), $entity_type_id);
        $this->contentEntityPaths = array_merge($this->contentEntityPaths, $entity_paths);
      }
    }
  }
  return $this->contentEntityPaths;
}