protected function EntityTypeInfo::addRevisionLinks in Workspace 8
Adds additional link relationships to an entity.
If these links already exist they will not be overridden.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: An entity type defintion to which to add links.
Return value
\Drupal\Core\Entity\EntityTypeInterface The modified type definition.
1 call to EntityTypeInfo::addRevisionLinks()
File
- src/
EntityTypeInfo.php, line 134
Class
- EntityTypeInfo
- Service class for manipulating entity type information.
Namespace
Drupal\workspaceCode
protected function addRevisionLinks(EntityTypeInterface $entity_type) {
if ($entity_type
->hasLinkTemplate('canonical')) {
if (!$entity_type
->hasLinkTemplate('version-tree')) {
$entity_type
->setLinkTemplate('version-tree', $entity_type
->getLinkTemplate('canonical') . '/tree');
}
if (!$entity_type
->hasLinkTemplate('revision')) {
$entity_type
->setLinkTemplate('revision', $entity_type
->getLinkTemplate('canonical') . '/revisions/{' . $entity_type
->id() . '_revision}/view');
}
}
return $entity_type;
}