Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / file_download.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/file_download.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/file_download.twig
new file mode 100644 (file)
index 0000000..8dd1bfb
--- /dev/null
@@ -0,0 +1,13 @@
+/**
+ * Implements hook_file_download().
+ */
+function {{ machine_name }}_file_download($uri) {
+  // Check to see if this is a config download.
+  $scheme = file_uri_scheme($uri);
+  $target = file_uri_target($uri);
+  if ($scheme == 'temporary' && $target == 'config.tar.gz') {
+    return [
+      'Content-disposition' => 'attachment; filename="config.tar.gz"',
+    ];
+  }
+}