From: Coleman Watts Date: Fri, 26 Apr 2019 12:56:46 +0000 (-0400) Subject: Alter menubar breakpoint to match WP admin theme X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=62c20d1eb87fbd5bb9a42e4d237c7192bd81e856;p=civicrm-core.git Alter menubar breakpoint to match WP admin theme --- diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index 6733d57f7e..4706b2672c 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -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 { diff --git a/CRM/Utils/System/Base.php b/CRM/Utils/System/Base.php index 0ad46528d4..8bb09e260f 100644 --- a/CRM/Utils/System/Base.php +++ b/CRM/Utils/System/Base.php @@ -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 diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index 5beecc51ea..0f67b9be38 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -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 */ diff --git a/Civi/Core/Container.php b/Civi/Core/Container.php index 579ee3083e..9ce531d1bb 100644 --- a/Civi/Core/Container.php +++ b/Civi/Core/Container.php @@ -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']);