-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
CRM-21243 WordPress: logo in admin menu now uses SVG and works like others #118
Conversation
agh1
commented
Sep 30, 2017
•
edited by civicrm-builder
Loading
edited by civicrm-builder
- CRM-21243: Logo in WP menu doesn't follow standard
@kcristiano can you do a quick test of this? |
@colemanw @agh1 I like the look as we now fllow the standard. Installed patch and works as expected. For reference https://developer.wordpress.org/reference/functions/add_menu_page/ details that adding the svg as a base64-encoded SVG using a data URI is compliant with the WP standards. OK to merge from my perspective. |
civicrm.php
Outdated
@@ -737,17 +737,11 @@ public function enable_translation() { | |||
*/ | |||
public function add_menu_items() { | |||
|
|||
$civilogo = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiCiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIKICAgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzb2RpcG9kaT0iaHR0cDovL3NvZGlwb2RpLnNvdXJjZWZvcmdlLm5ldC9EVEQvc29kaXBvZGktMC5kdGQiCiAgIHhtbG5zOmlua3NjYXBlPSJodHRwO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IC0wLjcxNTc1LC0zLjQwMTc2IC0yLjkxNzk3LC01LjU2NjQxIC0yLjkxNzk3LC01LjU2NjQxIGwgLTQ0LjIwNzAzLC00OS4yOTI5NyBjIC0yLjAwNjE0LC0yLjIzNjg1IC00LjExOTEsLTMuNjMzNjIgLTYuNDU4OTgsLTMuOTI5NjggeiBtIC0wLjg0MTgsNi42NjYwMSBjIDAuMTM5MjQsMC4wMTc2IDAuOTM5OTYsMC4yMzQ4NiAyLjI5ODgzLDEuNzUgbCA0NC4yMDcwMyw0OS4yOTI5NyBjIDAsMCAxLjE1OTc1LDEuNTg4NCAxLjM0Mzc1LDIuNDYyODkgMC4wOTIsMC40MzcyNSAwLjA4NDMsMC4zNjc3NyAtMC4wMDQsMC40ODQzOCAtMC4wODgyLDAuMTE2NiAtMC42Nzg2MywwLjcwMzMzIC0yLjY2Nzk3LDEuMTI2OTUgbCAtNjQuNzk4ODIsMTMuNzg5MDYgYyAwLDAgLTEuOTU4NDIsMC4yMTQ5MiAtMi44MDA3OSwtMC4wNTg2IC0wLjQyMTE4LC0wLjEzNjc2IC0wLjM0ODU3LC0wLjEwNDY2IC0wLjQwMjM0LC0wLjIzMjQyIC0wLjA1MzgsLTAuMTI3NzcgLTAuMjY2NDQsLTAuOTMwMjMgMC4zNjUyNCwtMi44NjUyNCBsIDIwLjU5NTcsLTYzLjEyMTA5IGMgMCwwIDAuNzk0NDMsLTEuODAzMSAxLjQ1NTA4LC0yLjM5NjQ5IDAuMzMwMzIsLTAuMjk2NjkgMC4yNjg5NiwtMC4yNTAwNCAwLjQwODIsLTAuMjMyNDIgeiIKICAgICAgIGlkPSJwYXRoNDYiCiAgICAgICBpbmtzY2FwZTpjb25uZWN0b3ItY3VydmF0dXJlPSIwIiAvPjwvZz48L3N2Zz4='; | |||
|
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.
👍 for SVG.
A slight nitpick... this does add 18kb of inscrutable code in two source files, and they're duplicates, and they don't need to parsed/read on every page-request. It would make sense to do something like:
$civilogo = file_get_contents(__DIR__ . "civilog.svg.b64");
or maybe
$civilogo = 'data:image/svg+xml;base64,' . base64_encode(file_get_contents(__DIR__ . "civilog.svg"));
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.
I was thinking about the second, but I didn't want to require the server to encode the file every time the admin menu appears. I never really thought about splitting the difference by going about it the first way, but I think I'll do that.
@totten I just pulled the SVG to its own file and it appears to be working as well as before. |
@agh1 do we need file_get_contents since we are referencing an image file? |
@kcristiano yeah b/c it still needs to be an inline base64 image when it hits the browser. the last commit is just a housekeeping measure for internal purposes. |
Cool. |