From: Coleman Watts Date: Fri, 26 Sep 2014 16:59:57 +0000 (-0400) Subject: CRM-15346 - Ensure drupal.behaviors are triggered X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f9f361d0b91f16a99f08d677099a2da44acb154b;p=civicrm-core.git CRM-15346 - Ensure drupal.behaviors are triggered --- diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index 5825a8ce74..2bbfcc4711 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -657,6 +657,10 @@ class CRM_Core_Resources { } } } + + // CMS-specific resources + $config->userSystem->appendCoreResources($items); + return $items; } } diff --git a/CRM/Utils/System/Base.php b/CRM/Utils/System/Base.php index e52558d3b7..02109a6f52 100644 --- a/CRM/Utils/System/Base.php +++ b/CRM/Utils/System/Base.php @@ -361,5 +361,10 @@ abstract class CRM_Utils_System_Base { function logger($message) { } + + /** + * Append to coreResourcesList + */ + function appendCoreResources(&$list) {} } diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index 3fc5054e03..0e63845ee1 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -290,4 +290,11 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base { function clearResourceCache() { _drupal_flush_css_js(); } + + /** + * Append to coreResourcesList + */ + function appendCoreResources(&$list) { + $list[] = 'js/crm.drupal.js'; + } } diff --git a/js/crm.drupal.js b/js/crm.drupal.js new file mode 100644 index 0000000000..0e352f996a --- /dev/null +++ b/js/crm.drupal.js @@ -0,0 +1,7 @@ +// http://civicrm.org/licensing +CRM.$(function($) { + $(document).on('crmLoad', function() { + // This is drupal's old-school way of listening for 'load' type events. It has to be called manually. + Drupal.attachBehaviors(this); + }); +});