From 52631cc977f2337439c7741f133df02f145cfa8d Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 23 Apr 2024 17:41:15 +0400 Subject: [PATCH] autohide_label par control --- nur_src/v/bs3/fo/ControlVisualInput.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nur_src/v/bs3/fo/ControlVisualInput.php b/nur_src/v/bs3/fo/ControlVisualInput.php index b9ccef6..652b286 100644 --- a/nur_src/v/bs3/fo/ControlVisualInput.php +++ b/nur_src/v/bs3/fo/ControlVisualInput.php @@ -13,6 +13,7 @@ abstract class ControlVisualInput extends ControlVisual { const PARAMETRABLE_PARAMS_SCHEMA = [ "label" => ["?content", null, "libellé du champ"], + "autohide_label" => ["?bool", null, "faut-il cacher le label s'il y a le placeholder?"], "placeholder" => ["?content", null, "valeur suggérée"], "required" => ["?bool", null, "ce champ est-il requis?"], "show_required" => ["?bool", null, "faut-il afficher la marque de champ requis?"], @@ -27,6 +28,9 @@ abstract class ControlVisualInput extends ControlVisual { /** @var array|string */ protected $ppLabel; + /** @var ?bool */ + protected $ppAutohideLabel; + /** @var array|string */ protected $ppPlaceholder; @@ -62,8 +66,10 @@ abstract class ControlVisualInput extends ControlVisual { $name = $this->ppName; $value = $this->ppValue; $label = $this->ppLabel; - if ($form->isAutohideLabel() && $this->ppPlaceholder && !$value) $label = null; - $showLabel = $label || !$form->isAutohideLabel(); + $autohideLabel = $this->ppAutohideLabel; + if ($autohideLabel === null) $autohideLabel = $form->isAutohideLabel(); + if ($autohideLabel && $this->ppPlaceholder && !$value) $label = null; + $showLabel = $label || !$autohideLabel; if ($label && $this->ppRequired && $this->ppShowRequired) { $label = [q($label), " (*)"]; } else {