Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / entity_delete.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/entity_delete.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/entity_delete.twig
new file mode 100644 (file)
index 0000000..e8f3ddf
--- /dev/null
@@ -0,0 +1,10 @@
+/**
+ * Implements hook_entity_delete().
+ */
+function {{ machine_name }}_entity_delete(Drupal\Core\Entity\EntityInterface $entity) {
+  // Delete the entity's entry from a fictional table of all entities.
+  db_delete('example_entity')
+    ->condition('type', $entity->getEntityTypeId())
+    ->condition('id', $entity->id())
+    ->execute();
+}