function 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 261
Class
- LanguageNegotiationContentEntity
- Class for identifying the content translation language.
Namespace
Drupal\language\Plugin\LanguageNegotiationCode
protected function getContentEntityPaths() {
if (!isset($this->contentEntityPaths)) {
$this->contentEntityPaths = [];
$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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.