Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
c4560ed2
Commit
c4560ed2
authored
5 years ago
by
colemanw
Browse files
Options
Downloads
Patches
Plain Diff
Add hook to influince menubar css variables
parent
4373b3dd
Branches
master-doctrine
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CRM/Core/Resources.php
+7
-4
7 additions, 4 deletions
CRM/Core/Resources.php
CRM/Utils/Hook.php
+18
-0
18 additions, 0 deletions
CRM/Utils/Hook.php
Civi/Core/AssetBuilder.php
+2
-0
2 additions, 0 deletions
Civi/Core/AssetBuilder.php
with
27 additions
and
4 deletions
CRM/Core/Resources.php
+
7
−
4
View file @
c4560ed2
...
...
@@ -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'
=>
'40
px'
,
'breakMin'
=>
'768
px'
,
'breakMax'
=>
'767
px'
,
'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'
),
];
...
...
This diff is collapsed.
Click to expand it.
CRM/Utils/Hook.php
+
18
−
0
View file @
c4560ed2
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
Civi/Core/AssetBuilder.php
+
2
−
0
View file @
c4560ed2
...
...
@@ -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"
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment