You are here

function heartbeat_uninstall in Heartbeat 8

Same name and namespace in other branches
  1. 6.4 heartbeat.install \heartbeat_uninstall()
  2. 6.3 heartbeat.install \heartbeat_uninstall()
  3. 7 heartbeat.install \heartbeat_uninstall()

File

./heartbeat.install, line 323
Install, update and uninstall functions for the node module.

Code

function heartbeat_uninstall() {
  $entities = \Drupal::service("entity.query")
    ->get("heartbeat")
    ->execute();
  foreach ($entities as $entity) {
    $heartbeat = \Drupal::service("entity_type.manager")
      ->getStorage("heartbeat")
      ->load($entity);
    $heartbeat
      ->delete();
  }
  $entities = \Drupal::service("entity.query")
    ->get("heartbeat_stream")
    ->execute();
  foreach ($entities as $entity) {
    $heartbeat = \Drupal::service("entity_type.manager")
      ->getStorage("heartbeat_stream")
      ->load($entity);
    $heartbeat
      ->delete();
  }
}