Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
WCMS
uw_theme_admin
Commits
95a6207f
Commit
95a6207f
authored
Jun 10, 2021
by
Liam Morland
Browse files
Merge branch '1.0.x' into 'prod/1.0.x'
Tag 1.0.1 See merge request
!7
parents
3435e356
0544fd9c
Changes
2
Hide whitespace changes
Inline
Side-by-side
config/optional/block.block.uw_theme_admin_help.yml
deleted
100644 → 0
View file @
3435e356
langcode
:
en
status
:
true
dependencies
:
module
:
-
help
theme
:
-
uw_theme_admin
id
:
uw_theme_admin_help
theme
:
uw_theme_admin
region
:
help
weight
:
0
provider
:
null
plugin
:
help_block
settings
:
id
:
help_block
label
:
Help
provider
:
help
label_display
:
'
0'
visibility
:
{
}
uw_theme_admin.theme
0 → 100644
View file @
95a6207f
<?php
/**
* @file
* Theme file for uw_theme_admin.
*/
/**
* Implements hook_preprocess_HOOK().
*
* Setting the favicon information.
*/
function
uw_theme_admin_preprocess_html
(
&
$variables
)
{
// @todo figure out a way to call a function from a different theme,
// or move _uw_fdsu_theme_resp_add_favicons($variables) to a module.
// For now, we are just copying that function here.
_uw_theme_admin_add_favicons
(
$variables
);
}
/**
* Add favicons to the page when called from hook_preprocess_html().
*
* @param array $variables
* The variables array.
*/
function
_uw_theme_admin_add_favicons
(
array
&
$variables
)
{
// 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_base_path
=
base_path
()
.
drupal_get_path
(
'theme'
,
'uw_fdsu_theme_resp'
);
$favicon
=
[
'rel'
=>
'icon'
,
'href'
=>
$favicon_base_path
.
'/favicon.ico'
,
];
$variables
[
'page'
][
'#attached'
][
'html_head_link'
][]
=
[
$favicon
];
$favicon_svg
=
[
'rel'
=>
'icon'
,
'href'
=>
$favicon_base_path
.
'/icon.svg'
,
'type'
=>
'image/svg+xml'
,
];
$variables
[
'page'
][
'#attached'
][
'html_head_link'
][]
=
[
$favicon_svg
];
$favicon_apple
=
[
'rel'
=>
'apple-touch-icon'
,
'href'
=>
$favicon_base_path
.
'/apple-touch-icon.png'
,
];
$variables
[
'page'
][
'#attached'
][
'html_head_link'
][]
=
[
$favicon_apple
];
$manifest
=
[
'icons'
=>
[
[
'src'
=>
$favicon_base_path
.
'/icon-192.png'
,
'type'
=>
'image/png'
,
'sizes'
=>
'192x192'
,
],
[
'src'
=>
$favicon_base_path
.
'/icon-512.png'
,
'type'
=>
'image/png'
,
'sizes'
=>
'512x512'
,
],
],
];
$manifest
=
json_encode
(
$manifest
);
$favicon_manifest
=
[
'rel'
=>
'manifest'
,
'href'
=>
'data:application/manifest+json,'
.
$manifest
,
];
$variables
[
'page'
][
'#attached'
][
'html_head_link'
][]
=
[
$favicon_manifest
];
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment