[9.2.22] aperçu de la police dans les sélecteurs

This commit is contained in:
Fred Tempez 2020-02-18 15:20:21 +01:00
parent 88bf29bfb6
commit 01c71be0be
6 changed files with 80 additions and 58 deletions

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
## version 9.2.22
- Modification :
- Aperçu de la police dans les sélecteurs.
## version 9.2.21 ## version 9.2.21
- Correction : - Correction :
- Footer / Texte personnalisé : suppression des sauts de ligne et de paragraphe. - Footer / Texte personnalisé : suppression des sauts de ligne et de paragraphe.

View File

@ -33,7 +33,7 @@ class common {
const TEMP_DIR = 'site/tmp/'; const TEMP_DIR = 'site/tmp/';
// Numéro de version // Numéro de version
const ZWII_VERSION = '9.2.21'; const ZWII_VERSION = '9.2.22';
public static $actions = []; public static $actions = [];
public static $coreModuleIds = [ public static $coreModuleIds = [
@ -3169,12 +3169,19 @@ class template {
'id' => $nameId, 'id' => $nameId,
'label' => '', 'label' => '',
'name' => $nameId, 'name' => $nameId,
'selected' => '' 'selected' => '',
'fonts' => false
], $attributes); ], $attributes);
// Sauvegarde des données en cas d'erreur // Sauvegarde des données en cas d'erreur
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) { if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
$attributes['selected'] = common::$inputBefore[$attributes['id']]; $attributes['selected'] = common::$inputBefore[$attributes['id']];
} }
// Liste des polices à intégrer
if ($attributes['fonts'] === true) {
foreach ($options as $fontId) {
echo "<link href='http://fonts.googleapis.com/css?family=".str_replace(" ", "+", $fontId)."' rel='stylesheet' type='text/css'>\n";
}
}
// Début du wrapper // Début du wrapper
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">'; $html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">';
// Label // Label
@ -3195,7 +3202,13 @@ class template {
helper::sprintAttributes($attributes) helper::sprintAttributes($attributes)
); );
foreach($options as $value => $text) { 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'] == str_replace('+',' ',$value) ? ' selected' : '', // Double == pour ignorer le type de variable car $_POST change les types en string
str_replace('+',' ',$value),
$text
) : sprintf(
'<option value="%s"%s>%s</option>', '<option value="%s"%s>%s</option>',
$value, $value,
$attributes['selected'] == $value ? ' selected' : '', // Double == pour ignorer le type de variable car $_POST change les types en string $attributes['selected'] == $value ? ' selected' : '', // Double == pour ignorer le type de variable car $_POST change les types en string

View File

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

View File

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

View File

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

View File

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