Skip to content
Snippets Groups Projects
Commit c4560ed2 authored by colemanw's avatar colemanw
Browse files

Add hook to influince menubar css variables

parent 4373b3dd
No related tags found
No related merge requests found
......@@ -767,6 +767,9 @@ class CRM_Core_Resources {
$items[] = 'js/crm.menubar.js';
$items[] = Civi::service('asset_builder')->getUrl('crm-menubar.css', [
'color' => Civi::settings()->get('menubar_color'),
'height' => 40,
'breakpoint' => 768,
'opacity' => .88,
]);
$items[] = [
'menubar' => [
......@@ -852,11 +855,11 @@ class CRM_Core_Resources {
}
$vars = [
'resourceBase' => rtrim($config->resourceBase, '/'),
'menubarHeight' => '40px',
'breakMin' => '768px',
'breakMax' => '767px',
'menubarHeight' => $e->params['height'] . 'px',
'breakMin' => $e->params['breakpoint'] . 'px',
'breakMax' => ($e->params['breakpoint'] - 1) . 'px',
'menubarColor' => $color,
'semiTransparentMenuColor' => 'rgba(' . implode(', ', CRM_Utils_Color::getRgb($color)) . ', .85)',
'semiTransparentMenuColor' => 'rgba(' . implode(', ', CRM_Utils_Color::getRgb($color)) . ", {$e->params['opacity']})",
'highlightColor' => CRM_Utils_Color::getHighlight($color),
'textColor' => CRM_Utils_Color::getContrast($color, '#333', '#ddd'),
];
......
......@@ -2217,6 +2217,24 @@ abstract class CRM_Utils_Hook {
Civi::dispatcher()->dispatch('hook_civicrm_alterAngular', $event);
}
/**
* This hook is called when building a link to a semi-static asset.
*
* @param string $asset
* The name of the asset.
* Ex: 'angular.json'
* @param array $params
* List of optional arguments which influence the content.
* @return null
* the return value is ignored
*/
public static function getAssetUrl(&$asset, &$params) {
return self::singleton()->invoke(['asset', 'params'],
$asset, $params, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_getAssetUrl'
);
}
/**
* This hook is called whenever the system builds a new copy of
* semi-static asset.
......
......@@ -125,6 +125,8 @@ class AssetBuilder {
* Ex: 'http://example.org/files/civicrm/dyn/angular.abcd1234abcd1234.json'.
*/
public function getUrl($name, $params = []) {
\CRM_Utils_Hook::getAssetUrl($name, $params);
if (!$this->isValidName($name)) {
throw new \RuntimeException("Invalid dynamic asset name");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment