Greenwich - fix conflict btw bootstrap & jQuery UI button
authorColeman Watts <coleman@civicrm.org>
Wed, 7 Oct 2020 13:33:18 +0000 (09:33 -0400)
committerColeman Watts <coleman@civicrm.org>
Wed, 7 Oct 2020 13:33:33 +0000 (09:33 -0400)
This calls noConflict on the Bootstrap3 $.fn.button() method, essentially getting rid of it,
as it is not used by CiviCRM, whereas the jQuery UI $.fn.button() is used.

If we needed the boostrap button function, we could rename it with something like:
`$.fn.btn = $.fn.button.noConflict();`

ext/greenwich/greenwich.php
ext/greenwich/js/noConflict.js [new file with mode: 0644]

index 14c312e0a2483ea0ce7a90cdd51ce6e6b1b06b95..3f4ffc0b89f8b7a237395c7db0d892494c87bdad 100644 (file)
@@ -56,6 +56,9 @@ function greenwich_civicrm_alterBundle(CRM_Core_Resources_Bundle $bundle) {
       $bundle->addScriptFile('greenwich', 'extern/bootstrap3/assets/javascripts/bootstrap.min.js', [
         'translate' => FALSE,
       ]);
+      $bundle->addScriptFile('greenwich', 'js/noConflict.js', [
+        'translate' => FALSE,
+      ]);
       break;
   }
 }
diff --git a/ext/greenwich/js/noConflict.js b/ext/greenwich/js/noConflict.js
new file mode 100644 (file)
index 0000000..ba41900
--- /dev/null
@@ -0,0 +1,4 @@
+// https://civicrm.org/licensing
+(function($) {
+  $.fn.button.noConflict();
+})(jQuery);