forked from ZwiiCMS-Team/ZwiiCMS
[10.0.023.dev] Favicon switcher
This commit is contained in:
parent
50aeb22034
commit
e679ebf1a3
@ -34,7 +34,7 @@ class common {
|
||||
const TEMP_DIR = 'site/tmp/';
|
||||
|
||||
// Numéro de version
|
||||
const ZWII_VERSION = '10.0.022.dev';
|
||||
const ZWII_VERSION = '10.0.023.dev';
|
||||
|
||||
public static $actions = [];
|
||||
public static $coreModuleIds = [
|
||||
@ -997,8 +997,6 @@ class common {
|
||||
|
||||
$pageList = array();
|
||||
|
||||
$pageList = array();
|
||||
|
||||
foreach ($this->getHierarchy(null,null,null) as $parentKey=>$parentValue) {
|
||||
$pageList [] = $parentKey;
|
||||
foreach ($parentValue as $childKey) {
|
||||
@ -1818,13 +1816,24 @@ class layout extends common {
|
||||
* Affiche le favicon
|
||||
*/
|
||||
public function showFavicon() {
|
||||
// Light scheme
|
||||
$favicon = $this->getData(['config', 'favicon']);
|
||||
if($favicon &&
|
||||
file_exists(self::FILE_DIR.'source/' . $favicon)
|
||||
) {
|
||||
echo '<link rel="shortcut icon" href="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $favicon . '">';
|
||||
echo '<link rel="shortcut icon" media="(prefers-color-scheme:light)" href="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $favicon . '">';
|
||||
} else {
|
||||
echo '<link rel="shortcut icon" href="' . helper::baseUrl(false) . 'core/vendor/zwiico/ico/favicon.ico">';
|
||||
echo '<link rel="shortcut icon" media="(prefers-color-scheme:light)" href="' . helper::baseUrl(false) . 'core/vendor/zwiico/ico/favicon.ico">';
|
||||
}
|
||||
// Dark scheme
|
||||
$faviconDark = $this->getData(['config', 'faviconDark']);
|
||||
if($faviconDark &&
|
||||
file_exists(self::FILE_DIR.'source/' . $faviconDark)
|
||||
) {
|
||||
echo '<link rel="shortcut icon" media="(prefers-color-scheme:dark)" href="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $faviconDark . '">';
|
||||
echo '<script src="https://unpkg.com/favicon-switcher@1.2.0/dist/index.js" crossorigin="anonymous" type="application/javascript"></script>';
|
||||
} else {
|
||||
echo '<link rel="shortcut icon" media="(prefers-color-scheme:dark)" href="' . helper::baseUrl(false) . 'core/vendor/zwiico/ico/faviconDark.ico">';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -390,6 +390,7 @@ class config extends common {
|
||||
'maintenance' => $this->getInput('configMaintenance', helper::FILTER_BOOLEAN),
|
||||
'cookieConsent' => $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN),
|
||||
'favicon' => $this->getInput('configFavicon'),
|
||||
'faviconDark' => $this->getInput('configFaviconDark'),
|
||||
'social' => [
|
||||
'facebookId' => $this->getInput('configSocialFacebookId'),
|
||||
'linkedinId' => $this->getInput('configSocialLinkedinId'),
|
||||
|
@ -58,14 +58,22 @@
|
||||
<div class="block">
|
||||
<h4>Réglages</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="col3">
|
||||
<?php echo template::file('configFavicon', [
|
||||
'type' => 1,
|
||||
'help' => 'Pensez à supprimer le cache de votre navigateur si la favicon ne change pas.',
|
||||
'label' => 'Favicon',
|
||||
'label' => 'Favicon thème clair',
|
||||
'value' => $this->getData(['config', 'favicon'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::file('configFaviconDark', [
|
||||
'type' => 1,
|
||||
'help' => 'Sélectionnez une icône adaptée à un thème sombre.<br>Pensez à supprimer le cache de votre navigateur si la favicon ne change pas.',
|
||||
'label' => 'Favicon thème sombre',
|
||||
'value' => $this->getData(['config', 'faviconDark'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('itemsperPage', $module::$ItemsList, [
|
||||
'label' => 'Articles par page',
|
||||
|
BIN
core/vendor/zwiico/ico/faviconDark.ico
vendored
Normal file
BIN
core/vendor/zwiico/ico/faviconDark.ico
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
sitemap.xml.gz
BIN
sitemap.xml.gz
Binary file not shown.
Loading…
Reference in New Issue
Block a user