You are here

function domain_alias_domain_delete in Domain Access 8

Same name and namespace in other branches
  1. 7.3 domain_alias/domain_alias.domain.inc \domain_alias_domain_delete()

Implements hook_ENTITY_TYPE_delete().

File

domain_alias/domain_alias.module, line 167
Maps multiple host requests to a single domain record.

Code

function domain_alias_domain_delete(EntityInterface $entity) {
  $alias_storage = \Drupal::entityTypeManager()
    ->getStorage('domain_alias');
  $properties = [
    'domain_id' => $entity
      ->id(),
  ];
  foreach ($alias_storage
    ->loadByProperties($properties) as $alias) {
    $alias
      ->delete();
  }
}