Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / library_alter.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d7/hook/library_alter.twig b/vendor/chi-teck/drupal-code-generator/templates/d7/hook/library_alter.twig
new file mode 100644 (file)
index 0000000..492ffb6
--- /dev/null
@@ -0,0 +1,16 @@
+/**
+ * Implements hook_library_alter().
+ */
+function {{ machine_name }}_library_alter(&$libraries, $module) {
+  // Update Farbtastic to version 2.0.
+  if ($module == 'system' && isset($libraries['farbtastic'])) {
+    // Verify existing version is older than the one we are updating to.
+    if (version_compare($libraries['farbtastic']['version'], '2.0', '<')) {
+      // Update the existing Farbtastic to version 2.0.
+      $libraries['farbtastic']['version'] = '2.0';
+      $libraries['farbtastic']['js'] = array(
+        drupal_get_path('module', 'farbtastic_update') . '/farbtastic-2.0.js' => array(),
+      );
+    }
+  }
+}