From d4ce3526b9ea9b4e34b6ae128f56c0f5689b80f8 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sun, 23 Feb 2020 12:08:56 +0100 Subject: [PATCH] [9.2.22] vignette album optimisation --- module/gallery/gallery.php | 6 ++---- module/gallery/view/index/index.php | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 9cd1edc1..8223adfd 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -180,11 +180,9 @@ class gallery extends common { // Photo de la page de garde de l'album $homePictures = []; foreach((array) $this->getInput('homePicture', null) as $file => $homePicture) { - $homePictures[$file] = $file; + // null : pas de variable définie (compatibilité) ou choix non effectif + $homePictures[$file] = $file === 0 ? null : helper::filter($file, helper::FILTER_STRING_SHORT) ; } - // Pas de sélection, retourne NULL plutôt que 0 - // Permet de traiter aussi le cas où l'image d'album n'est pas définie. - $homePictures[$file] = $homePictures[$file] === 0 ? NULL : $homePictures[$file]; $this->setData(['module', $this->getUrl(0), $galleryId, [ 'config' => [ 'name' => $this->getInput('galleryEditName', helper::FILTER_STRING_SHORT, true), diff --git a/module/gallery/view/index/index.php b/module/gallery/view/index/index.php index 51e9a7c8..b2040e8b 100644 --- a/module/gallery/view/index/index.php +++ b/module/gallery/view/index/index.php @@ -10,7 +10,7 @@ href="getUrl(0); ?>/" class="galleryPicture" style="background-image:url('getData(['module', $this->getUrl(0), $galleryId, 'config', 'homePicture']) === NULL ) { + if ($this->getData(['module', $this->getUrl(0), $galleryId, 'config', 'homePicture']) === null ) { echo helper::baseUrl(false) . $module::$firstPictures[$galleryId]; } else { echo helper::baseUrl(false) . $this->getData(['module', $this->getUrl(0), $galleryId, 'config', 'directory']) . '/' . $this->getData(['module', $this->getUrl(0), $galleryId, 'config', 'homePicture']);