From 3bfcaa418776940e570890b6c426f4d7bcf99bab Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Wed, 17 Jan 2024 18:27:21 +0100 Subject: [PATCH] =?UTF-8?q?Th=C3=A8me=20fonte=20Am=C3=A9liore=20le=20code?= =?UTF-8?q?=20discrimant=20les=20fontes=20utilis=C3=A9es=20et=20prend=20en?= =?UTF-8?q?=20compte=20le=20th=C3=A8me=20admin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/module/theme/theme.php | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index f0b4c662..37616ab4 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -628,16 +628,16 @@ class theme extends common // Toutes les fontes installées sont chargées $this->setFonts('all'); + // Polices liées au thème admin + $fonts['Titre (admin)'] = $this->getData(['admin', 'fontTitle']); + $fonts['Texte (admin)'] = $this->getData(['admin', 'fontText']); + // Polices liées au thème - $used = [ - 'Bannière' => $this->getData(['theme', 'header', 'font']), - 'Menu' => $this->getData(['theme', 'menu', 'font']), - 'Titre ' => $this->getData(['theme', 'title', 'font']), - 'Texte' => $this->getData(['theme', 'text', 'font']), - 'Pied de page' => $this->getData(['theme', 'footer', 'font']), - 'Titre (admin)' => $this->getData(['admin', 'fontTitle']), - 'Admin (texte)' => $this->getData(['admin', 'fontText']) - ]; + $fonts['Bannière'] = $this->getData(['theme', 'header', 'font']); + $fonts['Menu'] = $this->getData(['theme', 'menu', 'font']); + $fonts['Titre'] = $this->getData(['theme', 'title', 'font']); + $fonts['Texte'] = $this->getData(['theme', 'text', 'font']); + $fonts['Pied de page'] = $this->getData(['theme', 'footer', 'font']); // Récupérer le détail des fontes installées //$f = $this->getFonts(); @@ -649,18 +649,17 @@ class theme extends common foreach ($f as $type => $typeValue) { if (is_array($typeValue)) { foreach ($typeValue as $fontId => $fontValue) { - // Fontes utilisées par les thèmes - $fontUsed[$fontId] = ''; - foreach ($used as $key => $value) { - if ($value === $fontId) { - $fontUsed[$fontId] .= $key . '
'; - } - } + // Recherche les correspondances + $result = array_filter($fonts, function($value) use ($fontId) { + return $value == $fontId; + }); + $keyResults = array_keys($result); + // Préparation du tableau self::$fontsDetail[] = [ $fontId, '' . $f[$type][$fontId]['name'] . '', $f[$type][$fontId]['font-family'], - $fontUsed[$fontId], + empty($keyResults) ? '' : '' . implode('
', $keyResults) . '
', $type, $type !== 'websafe' ? template::button('themeFontEdit' . $fontId, [ 'class' => 'themeFontEdit',