Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
uw_fdsu_theme_resp
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
WCMS
uw_fdsu_theme_resp
Commits
2859d8dd
Commit
2859d8dd
authored
3 years ago
by
Kevin Paxman
Committed by
Kevin Paxman
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add favicons (not sure if manifest format will work)
parent
c7473831
No related branches found
No related tags found
2 merge requests
!32
Tag 1.0.1
,
!29
ISTWCMS-4864: add favicons
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
uw_fdsu_theme_resp.theme
+38
-1
38 additions, 1 deletion
uw_fdsu_theme_resp.theme
with
38 additions
and
1 deletion
uw_fdsu_theme_resp.theme
+
38
−
1
View file @
2859d8dd
...
@@ -26,13 +26,50 @@ require_once dirname(__FILE__) . '/includes/views.inc';
...
@@ -26,13 +26,50 @@ require_once dirname(__FILE__) . '/includes/views.inc';
/**
/**
* Implements hook_preprocess_HOOK().
* Implements hook_preprocess_HOOK().
*
*
* Setting the faculty class colour.
* Setting the faculty class colour
and favicon information
.
*/
*/
function
uw_fdsu_theme_resp_preprocess_html
(
&
$variables
)
{
function
uw_fdsu_theme_resp_preprocess_html
(
&
$variables
)
{
// Adding the faculty colour class to the body.
// Adding the faculty colour class to the body.
$variables
[
'attributes'
][
'class'
][]
=
theme_get_setting
(
'wcms_colour_scheme'
,
'uw_fdsu_theme_resp'
)
?
theme_get_setting
(
'wcms_colour_scheme'
,
'uw_fdsu_theme_resp'
)
:
'org-default'
;
$variables
[
'attributes'
][
'class'
][]
=
theme_get_setting
(
'wcms_colour_scheme'
,
'uw_fdsu_theme_resp'
)
?
theme_get_setting
(
'wcms_colour_scheme'
,
'uw_fdsu_theme_resp'
)
:
'org-default'
;
$variables
[
'uw_admin_page'
]
=
\Drupal
::
service
(
'uw_cfg_common.uw_analytics'
)
->
administrationPage
();
$variables
[
'uw_admin_page'
]
=
\Drupal
::
service
(
'uw_cfg_common.uw_analytics'
)
->
administrationPage
();
// Remove Drupal's favicon.
foreach
(
$variables
[
'page'
][
'#attached'
][
'html_head_link'
]
as
$id
=>
$html_head_link
)
{
if
(
isset
(
$html_head_link
[
0
][
'rel'
])
&&
$html_head_link
[
0
][
'rel'
]
==
'shortcut icon'
)
{
unset
(
$variables
[
'page'
][
'#attached'
][
'html_head_link'
][
$id
]);
break
;
}
}
// Specify new favicon locations.
// Based on https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs.
$favicon
=
[
'rel'
=>
'icon'
,
'href'
=>
base_path
()
.
drupal_get_path
(
'theme'
,
'uw_fdsu_theme_resp'
)
.
'/favicon.ico'
,
];
$variables
[
'page'
][
'#attached'
][
'html_head_link'
][]
=
[
$favicon
];
$favicon_svg
=
[
'rel'
=>
'icon'
,
'href'
=>
base_path
()
.
drupal_get_path
(
'theme'
,
'uw_fdsu_theme_resp'
)
.
'/icon.svg'
,
'type'
=>
'image/svg+xml'
,
];
$variables
[
'page'
][
'#attached'
][
'html_head_link'
][]
=
[
$favicon_svg
];
$favicon_apple
=
[
'rel'
=>
'apple-touch-icon'
,
'href'
=>
base_path
()
.
drupal_get_path
(
'theme'
,
'uw_fdsu_theme_resp'
)
.
'/apple-touch-icon.png'
,
];
$variables
[
'page'
][
'#attached'
][
'html_head_link'
][]
=
[
$favicon_apple
];
$favicon_manifest
=
[
'rel'
=>
'manifest'
,
'href'
=>
'data:application/manifest+json,{
"icons": [
{ "src": "'
.
base_path
()
.
drupal_get_path
(
'theme'
,
'uw_fdsu_theme_resp'
)
.
'/icon-192.png", "type": "image/png", "sizes": "192x192" },
{ "src": "'
.
base_path
()
.
drupal_get_path
(
'theme'
,
'uw_fdsu_theme_resp'
)
.
'/icon-512.png", "type": "image/png", "sizes": "512x512" }
]
}'
,
];
$variables
[
'page'
][
'#attached'
][
'html_head_link'
][]
=
[
$favicon_manifest
];
}
}
/**
/**
...
...
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