-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better support for hookable menubar colors #14944
Conversation
(Standard links)
|
@eileenmcnaughton I targeted this one for the RC based on your comments on #14924. |
} | ||
$params = $e->params; | ||
// "color" is deprecated in favor of the more specific "menubarColor" | ||
$menubarColor = $params['color'] ?? $params['menubarColor']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If color (sic) is deprecated why is it the 'first choice' here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if someone has implemented this hook to alter the "color" param, then we should continue to honor that. Otherwise we use the new param.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
This looks good to merge. Did an r-run on both Drupal and WP. With and Without Shoreditch. Shoreditch looks to be able to override any menu color changes. Without Shoreditch it works as expected. The only concern is if a user attempts to change the menu color when an extension is overriding it they may be driven mad when it does not work as there is no indication that changing is not possible. Can we add a documentation task on this? |
@colemanw this is good to merge from my POV once you have considered @kcristiano feedback |
So this PR is aimed at avoiding that kind of user frustration so that themes can check settings before overriding colors rather than just clobbering them with css rules, but the theme has to implement it in a conditional way. I agree to writing some documentation about the correct way to implement the hook so that user preferences are respected. |
OK merging - leaving you to follow up with docs |
Overview
This makes it easier for themes such as Shoreditch to adjust menubar colors conditionally so as not to override user settings.
Before
Only base menu color could be changed via hook.
After
Base menu color, highlight color, text color, etc can all be changed via hook.
Technical Details
This also includes some general improvements to CRM_Utils_Color, making it easier to work with color settings. E.g. you can now set the menubar color to "green" and it will automatically be converted to the correct hex value. Tests included.