checkBox
extends Field
in package
Read onlyYes
Champ de formulaire case à cocher
Table of Contents
Properties
- $choices : array<string|int, mixed>
- $label : string
- $long : bool
- $selected : array<string|int, mixed>
Methods
- __construct() : mixed
- Création du champ
- selected() : array<int, string>
- extrait des paramètres GET/POST ceux correspondant au champ $fielfName et les restructurent comme une liste
- toString() : string
- retourne le code Html
Properties
$choices
public
array<string|int, mixed>
$choices
$label
public
string
$label
= ''
$long
public
bool
$long
= false
$selected
public
array<string|int, mixed>
$selected
= []
Methods
__construct()
Création du champ
public
__construct(array<int, string>|array<string, string> $choices[, string $label = '' ][, array<int, string> $selected = [] ][, bool $long = false ]) : mixed
Parameters
- $choices : array<int, string>|array<string, string>
-
soit une liste de nom=libellé, soit un dict [nom => libelléDuChoix]
- $label : string = ''
-
libellé pour indiquer ce champ dans le formulaire
- $selected : array<int, string> = []
-
liste des noms des choix par défaut
- $long : bool = false
-
vrai ssi les labels sont longs et doivent être affichés chacun sur une ligne
selected()
extrait des paramètres GET/POST ceux correspondant au champ $fielfName et les restructurent comme une liste
public
static selected(string $fieldName, array<string, string> $get) : array<int, string>
Parameters
- $fieldName : string
- $get : array<string, string>
-
la liste des champs get ou post en fonction de la méthode utilisée
Return values
array<int, string> —la liste des noms de choix sélectionnés
toString()
retourne le code Html
public
toString(string $name) : string
Parameters
- $name : string