Alter menubar breakpoint to match WP admin theme
authorColeman Watts <coleman@civicrm.org>
Fri, 26 Apr 2019 12:56:46 +0000 (08:56 -0400)
committerColeman Watts <coleman@civicrm.org>
Fri, 26 Apr 2019 13:00:08 +0000 (09:00 -0400)
CRM/Utils/System.php
CRM/Utils/System/Base.php
CRM/Utils/System/WordPress.php
Civi/Core/Container.php

index 6733d57f7e2c0b620d593a9ca51af4d69230de10..4706b2672cf96f8f20a18eeec7df7b47e47c0069 100644 (file)
@@ -52,6 +52,7 @@
  * @method static setHttpHeader(string $name, string $value) Set http header.
  * @method static array synchronizeUsers() Create CRM contacts for all existing CMS users.
  * @method static appendCoreResources(\Civi\Core\Event\GenericHookEvent $e) Callback for hook_civicrm_coreResourceList.
+ * @method static alterAssetUrl(\Civi\Core\Event\GenericHookEvent $e) Callback for hook_civicrm_getAssetUrl.
  */
 class CRM_Utils_System {
 
index 0ad46528d4162e2e9266eb73ede5072faf36cd9b..8bb09e260fcd1a8cfec59cf5bb801894ab9dc5bb 100644 (file)
@@ -919,6 +919,14 @@ abstract class CRM_Utils_System_Base {
   public function appendCoreResources(\Civi\Core\Event\GenericHookEvent $e) {
   }
 
+  /**
+   * Modify dynamic assets.
+   *
+   * @param \Civi\Core\Event\GenericHookEvent $e
+   */
+  public function alterAssetUrl(\Civi\Core\Event\GenericHookEvent $e) {
+  }
+
   /**
    * @param string $name
    * @param string $value
index 5beecc51ea0d2e202e31dc925fe3b53ad7571e22..0f67b9be3853796d4ff350152e0344e39c67455c 100644 (file)
@@ -807,6 +807,16 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
     $e->list[] = 'js/crm.wordpress.js';
   }
 
+  /**
+   * @inheritDoc
+   */
+  public function alterAssetUrl(\Civi\Core\Event\GenericHookEvent $e) {
+    // Set menubar breakpoint to match WP admin theme
+    if ($e->asset == 'crm-menubar.css') {
+      $e->params['breakpoint'] = 783;
+    }
+  }
+
   /**
    * @inheritDoc
    */
index 579ee3083ee4b01e022b77ab3ff0afc40941c247..9ce531d1bb776fc3ad3994afe6e9c98a2435afdf 100644 (file)
@@ -322,6 +322,7 @@ class Container {
     $dispatcher->addListener('hook_civicrm_buildAsset', ['\CRM_Utils_VisualBundle', 'buildAssetCss']);
     $dispatcher->addListener('hook_civicrm_buildAsset', ['\CRM_Core_Resources', 'renderMenubarStylesheet']);
     $dispatcher->addListener('hook_civicrm_coreResourceList', ['\CRM_Utils_System', 'appendCoreResources']);
+    $dispatcher->addListener('hook_civicrm_getAssetUrl', ['\CRM_Utils_System', 'alterAssetUrl']);
     $dispatcher->addListener('civi.dao.postInsert', ['\CRM_Core_BAO_RecurringEntity', 'triggerInsert']);
     $dispatcher->addListener('civi.dao.postUpdate', ['\CRM_Core_BAO_RecurringEntity', 'triggerUpdate']);
     $dispatcher->addListener('civi.dao.postDelete', ['\CRM_Core_BAO_RecurringEntity', 'triggerDelete']);