You are here

function apigee_edge_teams_entity_type_alter in Apigee Edge 8

Implements hook_entity_type_alter().

File

modules/apigee_edge_teams/apigee_edge_teams.module, line 56
Copyright 2018 Google Inc.

Code

function apigee_edge_teams_entity_type_alter(array &$entity_types) {

  // Fixes Team App entity routes generated by the Devel module.
  // @see devel_entity_type_alter()
  // @see \Drupal\apigee_edge_teams\Routing\TeamAppDevelRouteFixerSubscriber
  if (\Drupal::moduleHandler()
    ->moduleExists('devel')) {

    /** @var \Drupal\Core\Entity\EntityTypeInterface $entity_type */
    $entity_type =& $entity_types['team_app'];
    if ($entity_type
      ->hasLinkTemplate('canonical')) {
      $canonical_link = $entity_type
        ->getLinkTemplate('canonical');
      $entity_type
        ->setLinkTemplate('devel-render', "{$canonical_link}/devel-render");
      $entity_type
        ->setLinkTemplate('devel-definition', "{$canonical_link}/devel-definition");
      if ($entity_type
        ->hasLinkTemplate('edit-form')) {
        $entity_type
          ->setLinkTemplate('devel-load', "{$canonical_link}/devel-load");
      }
    }
  }
}