Revert "Supprime la propriété fonts du template select"

This reverts commit e4b84b024f.
This commit is contained in:
Fred Tempez 2022-04-20 17:03:54 +02:00
parent e4b84b024f
commit 3177faf3f7
7 changed files with 25 additions and 12 deletions

View File

@ -611,7 +611,8 @@ class template {
'id' => $nameId,
'label' => '',
'name' => $nameId,
'selected' => ''
'selected' => '',
'fonts' => false
], $attributes);
// Sauvegarde des données en cas d'erreur
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
@ -637,7 +638,13 @@ class template {
helper::sprintAttributes($attributes)
);
foreach($options as $value => $text) {
$html .= sprintf(
$html .= $attributes['fonts'] === true ? sprintf(
'<option value="%s"%s style="font-family: %s;">%s</option>',
$value,
$attributes['selected'] == $value ? ' selected' : '', // Double == pour ignorer le type de variable car $_POST change les types en string
$text,
$text
) : sprintf(
'<option value="%s"%s>%s</option>',
$value,
$attributes['selected'] == $value ? ' selected' : '', // Double == pour ignorer le type de variable car $_POST change les types en string

View File

@ -571,6 +571,7 @@ class theme extends common {
];
// Récupérer le détail des fontes installées
//$f = $this->getFonts();
$f ['files'] = $this->getData(['fonts', 'files']);
$f ['imported'] = $this->getData(['fonts', 'imported']);
$f ['websafe'] = self::$fontsWebSafe;
@ -1124,8 +1125,7 @@ class theme extends common {
// Retourne un tableau simple des fonts installées idfont avec le nom
// Cette fonction est utile aux sélecteurs de fonts dans les formulaires.
// Génère une feuille de style pour l'aperçu des sélecteurs
private function enumFonts() {
public function enumFonts() {
// Récupère la liste des fontes installées
$f ['files'] = $this->getData(['fonts', 'files']);
$f ['imported'] = $this->getData(['fonts', 'imported']);
@ -1140,7 +1140,6 @@ class theme extends common {
}
ksort($fonts);
self::$fontsList = $fonts;
}
}

View File

@ -130,7 +130,8 @@
<div class="col4">
<?php echo template::select('adminFontText', $module::$fontsList, [
'label' => 'Police du texte',
'selected' => $this->getData(['admin', 'fontText'])
'selected' => $this->getData(['admin', 'fontText']),
'fonts' => true
]); ?>
</div>
<div class="col4">
@ -142,7 +143,8 @@
<div class="col4">
<?php echo template::select('adminFontTitle', $module::$fontsList, [
'label' => 'Police des titres',
'selected' => $this->getData(['admin', 'fontTitle'])
'selected' => $this->getData(['admin', 'fontTitle']),
'fonts' => true
]); ?>
</div>
</div>

View File

@ -173,7 +173,8 @@
<div class="col3">
<?php echo template::select('themeFooterFont', $module::$fontsList, [
'label' => 'Fonte',
'selected' => $this->getData(['theme', 'footer', 'font'])
'selected' => $this->getData(['theme', 'footer', 'font']),
'fonts' => true
]); ?>
</div>
<div class="col3">

View File

@ -108,7 +108,8 @@
<div class="col4">
<?php echo template::select('themeHeaderFont', $module::$fontsList, [
'label' => 'Fonte',
'selected' => $this->getData(['theme', 'header', 'font'])
'selected' => $this->getData(['theme', 'header', 'font']),
'fonts' => true
]); ?>
</div>
<div class="col4">

View File

@ -185,7 +185,8 @@
<div class="col6">
<?php echo template::select('themeMenuFont', $module::$fontsList, [
'label' => 'Fonte',
'selected' => $this->getData(['theme', 'menu', 'font'])
'selected' => $this->getData(['theme', 'menu', 'font']),
'fonts' => true
]); ?>
</div>
<div class="col6">

View File

@ -160,7 +160,8 @@
<div class="col6">
<?php echo template::select('themeTextFont', $module::$fontsList, [
'label' => 'Fonte',
'selected' => $this->getData(['theme', 'text', 'font'])
'selected' => $this->getData(['theme', 'text', 'font']),
'fonts' => true
]); ?>
</div>
<div class="col6">
@ -180,7 +181,8 @@
<div class="col4">
<?php echo template::select('themeTitleFont', $module::$fontsList, [
'label' => 'Fonte',
'selected' => $this->getData(['theme', 'title', 'font'])
'selected' => $this->getData(['theme', 'title', 'font']),
'fonts' => true
]); ?>
</div>
<div class="col4">