You are here

function apigee_edge_teams_entity_operation_alter in Apigee Edge 8

Implements hook_entity_operation_alter().

File

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

Code

function apigee_edge_teams_entity_operation_alter(array &$operations, EntityInterface $entity) {
  foreach ($operations as $key => $operation) {
    if (!in_array($operation['url']
      ->getRouteName(), TeamInactiveStatusSubscriber::getDisabledRoutes())) {
      continue;
    }
    $team = \Drupal::routeMatch()
      ->getParameter('team');
    if (!$team || $team
      ->getStatus() !== TeamInterface::STATUS_INACTIVE) {
      continue;
    }

    // Remove the entity operation if the team is inactive.
    unset($operations[$key]);
  }
}