Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / dropzonejs / dropzonejs.module
index f79d5784ddeaa0566c9b443f97c7d79dac0c758a..7f5120480d146c5a0511984bb647ec27f451eea2 100644 (file)
@@ -59,6 +59,39 @@ function template_preprocess_dropzonejs(array &$variables) {
   $variables['uploaded_files'] = $element['uploaded_files'];
 }
 
+/**
+ * Implements hook_library_info_build().
+ */
+function dropzonejs_library_info_build() {
+  $libraries = [];
+
+  if (\Drupal::moduleHandler()->moduleExists('libraries')) {
+    $exif_path = libraries_get_path('exif-js') . '/exif.js';
+  }
+  else {
+    $exif_path = DRUPAL_ROOT . '/libraries/exif-js/exif.js';
+  }
+
+  if ($exif_found = file_exists($exif_path)) {
+    $libraries['exif-js'] = [
+      'title' => 'Exif',
+      'website' => 'https://github.com/exif-js/exif-js',
+      'version' => 'v2.3.0',
+      'license' => [
+        'name' => 'MIT',
+        'url' => 'https://github.com/exif-js/exif-js/blob/master/LICENSE.md',
+        'gpl-compatible' => TRUE,
+      ],
+      'js' => [
+        '/libraries/exif-js/exif.js' => [],
+      ],
+    ];
+
+  }
+
+  return $libraries;
+}
+
 /**
  * Implements hook_library_info_alter().
  */
@@ -66,5 +99,9 @@ function dropzonejs_library_info_alter(&$libraries, $extension) {
   if ($extension == 'dropzonejs' && \Drupal::moduleHandler()->moduleExists('libraries')) {
     $libraries['dropzonejs']['js'] = ['/' . libraries_get_path('dropzone') . '/dist/min/dropzone.min.js' => []];
     $libraries['dropzonejs']['css']['component'] = ['/' . libraries_get_path('dropzone') . '/dist/min/dropzone.min.css' => []];
+
+    if ($exif_path = libraries_get_path('exif-js')) {
+      $libraries['exif-js']['js'] = ['/' . $exif_path . '/exif.js' => []];
+    }
   }
 }