You are here

public function RngEntityModel::hook_entity_predelete in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 src/RngEntityModel.php \Drupal\rng\RngEntityModel::hook_entity_predelete()
  2. 8 src/RngEntityModel.php \Drupal\rng\RngEntityModel::hook_entity_predelete()

React to Drupal `hook_entity_predelete` hook.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity object for the entity that is about to be deleted.

See also

hook_entity_predelete();

File

src/RngEntityModel.php, line 126

Class

RngEntityModel
Enforces RNG model relationships.

Namespace

Drupal\rng

Code

public function hook_entity_predelete(EntityInterface $entity) {
  if (in_array($entity
    ->getEntityType(), $this->identityChannelManager
    ->getIdentityTypes())) {
    $this
      ->deletePerson($entity);
  }
  if ($this->eventManager
    ->isEvent($entity)) {
    $this
      ->deleteRngEvent($entity);
  }
  if ($entity instanceof RuleComponentInterface) {
    $this
      ->deleteRngRuleComponent($entity);
  }
}