Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / entity_revision_delete.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/entity_revision_delete.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/entity_revision_delete.twig
new file mode 100644 (file)
index 0000000..c0c8978
--- /dev/null
@@ -0,0 +1,9 @@
+/**
+ * Implements hook_entity_revision_delete().
+ */
+function {{ machine_name }}_entity_revision_delete(Drupal\Core\Entity\EntityInterface $entity) {
+  $referenced_files_by_field = _editor_get_file_uuids_by_field($entity);
+  foreach ($referenced_files_by_field as $field => $uuids) {
+    _editor_delete_file_usage($uuids, $entity, 1);
+  }
+}