You are here

function og_entity_type_alter in Organic groups 8

Implements hook_entity_type_alter().

Add link template to groups. We add it to all the entity types, and later on return the correct access, depending if the bundle is indeed a group and accessible. We do not filter here the entity type by groups, so whenever GroupTypeManagerInterface::addGroup is called, it's enough to mark route to be rebuilt via RouteBuilder::setRebuildNeeded.

File

./og.module, line 304

Code

function og_entity_type_alter(array &$entity_types) {

  /** @var \Drupal\Core\Entity\EntityTypeInterface $entity_type */
  foreach ($entity_types as $entity_type_id => $entity_type) {
    $entity_type
      ->setLinkTemplate('og-admin-routes', "/group/{$entity_type_id}/{{$entity_type_id}}/admin");
  }
}