forked from ZwiiCMS-Team/ZwiiCMS
[9.2.22] aperçu de la police dans les sélecteurs
This commit is contained in:
parent
88bf29bfb6
commit
01c71be0be
@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## version 9.2.22
|
||||
- Modification :
|
||||
- Aperçu de la police dans les sélecteurs.
|
||||
|
||||
## version 9.2.21
|
||||
- Correction :
|
||||
- Footer / Texte personnalisé : suppression des sauts de ligne et de paragraphe.
|
||||
|
119
core/core.php
119
core/core.php
@ -33,7 +33,7 @@ class common {
|
||||
const TEMP_DIR = 'site/tmp/';
|
||||
|
||||
// Numéro de version
|
||||
const ZWII_VERSION = '9.2.21';
|
||||
const ZWII_VERSION = '9.2.22';
|
||||
|
||||
public static $actions = [];
|
||||
public static $coreModuleIds = [
|
||||
@ -3157,58 +3157,71 @@ class template {
|
||||
* @param array $attributes Attributs ($key => $value)
|
||||
* @return string
|
||||
*/
|
||||
public static function select($nameId, array $options, array $attributes = []) {
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'before' => true,
|
||||
'class' => '',
|
||||
'classWrapper' => '',
|
||||
'noDirty' => false,
|
||||
'disabled' => false,
|
||||
'help' => '',
|
||||
'id' => $nameId,
|
||||
'label' => '',
|
||||
'name' => $nameId,
|
||||
'selected' => ''
|
||||
], $attributes);
|
||||
// Sauvegarde des données en cas d'erreur
|
||||
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
$attributes['selected'] = common::$inputBefore[$attributes['id']];
|
||||
}
|
||||
// Début du wrapper
|
||||
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">';
|
||||
// Label
|
||||
if($attributes['label']) {
|
||||
$html .= self::label($attributes['id'], $attributes['label'], [
|
||||
'help' => $attributes['help']
|
||||
]);
|
||||
}
|
||||
// Notice
|
||||
$notice = '';
|
||||
if(array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
$notice = common::$inputNotices[$attributes['id']];
|
||||
$attributes['class'] .= ' notice';
|
||||
}
|
||||
$html .= self::notice($attributes['id'], $notice);
|
||||
// Début sélection
|
||||
$html .= sprintf('<select %s>',
|
||||
helper::sprintAttributes($attributes)
|
||||
);
|
||||
foreach($options as $value => $text) {
|
||||
$html .= 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
|
||||
$text
|
||||
);
|
||||
}
|
||||
// Fin sélection
|
||||
$html .= '</select>';
|
||||
// Fin du wrapper
|
||||
$html .= '</div>';
|
||||
// Retourne le html
|
||||
return $html;
|
||||
}
|
||||
public static function select($nameId, array $options, array $attributes = []) {
|
||||
// Attributs par défaut
|
||||
$attributes = array_merge([
|
||||
'before' => true,
|
||||
'class' => '',
|
||||
'classWrapper' => '',
|
||||
'noDirty' => false,
|
||||
'disabled' => false,
|
||||
'help' => '',
|
||||
'id' => $nameId,
|
||||
'label' => '',
|
||||
'name' => $nameId,
|
||||
'selected' => '',
|
||||
'fonts' => false
|
||||
], $attributes);
|
||||
// Sauvegarde des données en cas d'erreur
|
||||
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
$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
|
||||
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">';
|
||||
// Label
|
||||
if($attributes['label']) {
|
||||
$html .= self::label($attributes['id'], $attributes['label'], [
|
||||
'help' => $attributes['help']
|
||||
]);
|
||||
}
|
||||
// Notice
|
||||
$notice = '';
|
||||
if(array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
$notice = common::$inputNotices[$attributes['id']];
|
||||
$attributes['class'] .= ' notice';
|
||||
}
|
||||
$html .= self::notice($attributes['id'], $notice);
|
||||
// Début sélection
|
||||
$html .= sprintf('<select %s>',
|
||||
helper::sprintAttributes($attributes)
|
||||
);
|
||||
foreach($options as $value => $text) {
|
||||
$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>',
|
||||
$value,
|
||||
$attributes['selected'] == $value ? ' selected' : '', // Double == pour ignorer le type de variable car $_POST change les types en string
|
||||
$text
|
||||
);
|
||||
}
|
||||
// Fin sélection
|
||||
$html .= '</select>';
|
||||
// Fin du wrapper
|
||||
$html .= '</div>';
|
||||
// Retourne le html
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une bulle de dialogue
|
||||
|
@ -103,7 +103,8 @@
|
||||
<div class="col3">
|
||||
<?php echo template::select('themeFooterFont', $module::$fonts, [
|
||||
'label' => 'Police',
|
||||
'selected' => $this->getData(['theme', 'footer', 'font'])
|
||||
'selected' => $this->getData(['theme', 'footer', 'font']),
|
||||
'fonts' => true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
|
@ -143,7 +143,8 @@
|
||||
<div class="col3">
|
||||
<?php echo template::select('themeHeaderFont', $module::$fonts, [
|
||||
'label' => 'Police',
|
||||
'selected' => $this->getData(['theme', 'header', 'font'])
|
||||
'selected' => $this->getData(['theme', 'header', 'font']),
|
||||
'fonts' => true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
|
@ -82,7 +82,8 @@
|
||||
<div class="col6">
|
||||
<?php echo template::select('themeMenuFont', $module::$fonts, [
|
||||
'label' => 'Police',
|
||||
'selected' => $this->getData(['theme', 'menu', 'font'])
|
||||
'selected' => $this->getData(['theme', 'menu', 'font']),
|
||||
'fonts' => true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
|
@ -71,7 +71,8 @@
|
||||
<div class="col6">
|
||||
<?php echo template::select('themeTextFont', $module::$fonts, [
|
||||
'label' => 'Police',
|
||||
'selected' => $this->getData(['theme', 'text', 'font'])
|
||||
'selected' => $this->getData(['theme', 'text', 'font']),
|
||||
'fonts' => true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
@ -91,7 +92,8 @@
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeTitleFont', $module::$fonts, [
|
||||
'label' => 'Police',
|
||||
'selected' => $this->getData(['theme', 'title', 'font'])
|
||||
'selected' => $this->getData(['theme', 'title', 'font']),
|
||||
'fonts' => true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
|
Loading…
Reference in New Issue
Block a user