You are here

protected function LanguageNegotiationContentEntity::getContentEntityPaths in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationContentEntity::getContentEntityPaths()

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

Return value

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

File

core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php, line 279
Contains \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationContentEntity.

Class

LanguageNegotiationContentEntity
Class for identifying the content translation language.

Namespace

Drupal\language\Plugin\LanguageNegotiation

Code

protected function getContentEntityPaths() {
  if (!isset($this->contentEntityPaths)) {
    $this->contentEntityPaths = [];
    $entity_types = $this->entityManager
      ->getDefinitions();
    foreach ($entity_types as $entity_type_id => $entity_type) {
      if ($entity_type
        ->isSubclassOf(ContentEntityInterface::class)) {
        $entity_paths = array_fill_keys($entity_type
          ->getLinkTemplates(), $entity_type_id);
        $this->contentEntityPaths = array_merge($this->contentEntityPaths, $entity_paths);
      }
    }
  }
  return $this->contentEntityPaths;
}