function redhen_connection_entity_type_alter in RedHen CRM 8
Implements hook_entity_type_alter().
File
- modules/
redhen_connection/ redhen_connection.module, line 163 - Contains redhen_connection.module..
Code
function redhen_connection_entity_type_alter(array &$entity_types) {
// There's no good way to add a link template based on existing mapping
// definitions while we're building entity type definitions. We can't load
// existing mappings, because to do that we need to load entity types which
// creates an infinite recursion. So, we set the link template on any
// mappable entity, and hide it for any entity types that don't have
// mappings.
foreach ($entity_types as $entity_type_id => $entity_type) {
if ($entity_type
->hasViewBuilderClass() && $entity_type
->hasLinkTemplate('canonical')) {
$canonical = $entity_type
->getLinkTemplate('canonical');
$entity_type
->setLinkTemplate('redhen_connection', "{$canonical}/connections");
}
}
}