You are here

function apigee_edge_key_delete in Apigee Edge 8

Implements hook_key_delete().

File

./apigee_edge.module, line 1542
Copyright 2018 Google Inc.

Code

function apigee_edge_key_delete(EntityInterface $entity) {

  /** @var \Drupal\key\KeyInterface $entity */
  $active_key = \Drupal::configFactory()
    ->get('apigee_edge.auth')
    ->get('active_key');
  if ($active_key === $entity
    ->id()) {
    \Drupal::configFactory()
      ->getEditable('apigee_edge.auth')
      ->set('active_key', '')
      ->save();
  }
}