Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Référence de la classe JHtmlSelect

Fonctions membres publiques statiques

static booleanlist ($name, $attribs=array(), $selected=null, $yes='JYES', $no='JNO', $id=false)
 
static genericlist ($data, $name, $attribs=null, $optKey='value', $optText='text', $selected=null, $idtag=false, $translate=false)
 
static suggestionlist ($data, $optKey='value', $optText='text', $idtag=null, $translate=false)
 
static groupedlist ($data, $name, $options=array())
 
static integerlist ($start, $end, $inc, $name, $attribs=null, $selected=null, $format='')
 
static optgroup ($text, $optKey='value', $optText='text')
 
static option ($value, $text='', $optKey='value', $optText='text', $disable=false)
 
static options ($arr, $optKey='value', $optText='text', $selected=null, $translate=false)
 
static radiolist ($data, $name, $attribs=null, $optKey='value', $optText='text', $selected=null, $idtag=false, $translate=false)
 

Attributs protégés statiques

static $optionDefaults
 

Description détaillée

Utility class for creating HTML select lists

Depuis
1.5

Documentation des fonctions membres

◆ booleanlist()

static booleanlist (   $name,
  $attribs = array(),
  $selected = null,
  $yes = 'JYES',
  $no = 'JNO',
  $id = false 
)
static

Generates a yes/no radio list.

Paramètres
string$nameThe value of the HTML name attribute
array$attribsAdditional HTML attributes for the <select> tag
string$selectedThe key that is selected
string$yesLanguage key for Yes
string$noLanguage key for no
mixed$idThe id for the field or false for no id
Renvoie
string HTML for the radio list
Depuis
1.5
Voir également
JFormFieldRadio

Références $attribs, $id, $name, et $selected.

◆ genericlist()

static genericlist (   $data,
  $name,
  $attribs = null,
  $optKey = 'value',
  $optText = 'text',
  $selected = null,
  $idtag = false,
  $translate = false 
)
static

Generates an HTML selection list.

Paramètres
array$dataAn array of objects, arrays, or scalars.
string$nameThe value of the HTML name attribute.
mixed$attribsAdditional HTML attributes for the <select> tag. This can be an array of attributes, or an array of options. Treated as options if it is the last argument passed. Valid options are: Format options, see {
Voir également
JHtml::$formatOptions}. Selection options, see {
JHtmlSelect::options()}. list.attr, string|array: Additional attributes for the select element. id, string: Value to use as the select element id attribute. Defaults to the same as the name. list.select, string|array: Identifies one or more option elements to be selected, based on the option key values.
Paramètres
string$optKeyThe name of the object variable for the option value. If set to null, the index of the value array is used.
string$optTextThe name of the object variable for the option text.
mixed$selectedThe key that is selected (accepts an array or a string).
mixed$idtagValue of the field id or null by default
boolean$translateTrue to translate
Renvoie
string HTML for the select list.
Depuis
1.5

Références $attribs, $data, $html, $id, $name, $options, et $selected.

◆ groupedlist()

static groupedlist (   $data,
  $name,
  $options = array() 
)
static

Generates a grouped HTML selection list from nested arrays.

Paramètres
array$dataAn array of groups, each of which is an array of options.
string$nameThe value of the HTML name attribute
array$optionsOptions, an array of key/value pairs. Valid options are: Format options, {
Voir également
JHtml::$formatOptions}. Selection options. See {
JHtmlSelect::options()}. group.id: The property in each group to use as the group id attribute. Defaults to none. group.label: The property in each group to use as the group label. Defaults to "text". If set to null, the data array index key is used. group.items: The property in each group to use as the array of items in the group. Defaults to "items". If set to null, group.id and group. label are forced to null and the data element is assumed to be a list of selections. id: Value to use as the select element id attribute. Defaults to the same as the name. list.attr: Attributes for the select element. Can be a string or an array of key/value pairs. Defaults to none. list.select: either the value of one selected option or an array of selected options. Default: none. list.translate: Boolean. If set, text and labels are translated via JText::_().
Renvoie
string HTML for the select list
Depuis
1.5
Exceptions
RuntimeExceptionIf a group has contents that cannot be processed.

Références $attribs, $data, $html, $id, $label, $name, $options, elseif, et null.

◆ integerlist()

static integerlist (   $start,
  $end,
  $inc,
  $name,
  $attribs = null,
  $selected = null,
  $format = '' 
)
static

Generates a selection list of integers.

Paramètres
integer$startThe start integer
integer$endThe end integer
integer$incThe increment
string$nameThe value of the HTML name attribute
mixed$attribsAdditional HTML attributes for the <select> tag, an array of attributes, or an array of options. Treated as options if it is the last argument passed.
mixed$selectedThe key that is selected
string$formatThe printf format to be applied to the number
Renvoie
string HTML for the select list
Depuis
1.5

Références $attribs, $data, $format, $i, $name, $options, $selected, $start, et null.

◆ optgroup()

static optgroup (   $text,
  $optKey = 'value',
  $optText = 'text' 
)
static

Create a placeholder for an option group.

Paramètres
string$textThe text for the option
string$optKeyThe returned object property name for the value
string$optTextThe returned object property name for the text
Renvoie
stdClass
Obsolète:
4.0 Use JHtmlSelect::groupedList()
Voir également
JHtmlSelect::groupedList()
Depuis
1.5

Références $state, et $text.

◆ option()

static option (   $value,
  $text = '',
  $optKey = 'value',
  $optText = 'text',
  $disable = false 
)
static

Create an object that represents an option in an option list.

Paramètres
string$valueThe value of the option
string$textThe text for the option
mixed$optKeyIf a string, the returned object property name for the value. If an array, options. Valid options are: attr: String|array. Additional attributes for this option. Defaults to none. disable: Boolean. If set, this option is disabled. label: String. The value for the option label. option.attr: The property in each option array to use for additional selection attributes. Defaults to none. option.disable: The property that will hold the disabled state. Defaults to "disable". option.key: The property that will hold the selection value. Defaults to "value". option.label: The property in each option array to use as the selection label attribute. If a "label" option is provided, defaults to "label", if no label is given, defaults to null (none). option.text: The property that will hold the the displayed text. Defaults to "text". If set to null, the option array is assumed to be a list of displayable scalars.
string$optTextThe property that will hold the the displayed text. This parameter is ignored if an options array is passed.
boolean$disableNot used.
Renvoie
stdClass
Depuis
1.5

Références $options, et null.

◆ options()

static options (   $arr,
  $optKey = 'value',
  $optText = 'text',
  $selected = null,
  $translate = false 
)
static

Generates the option tags for an HTML select list (with no select tag surrounding the options).

Paramètres
array$arrAn array of objects, arrays, or values.
mixed$optKeyIf a string, this is the name of the object variable for the option value. If null, the index of the array of objects is used. If an array, this is a set of options, as key/value pairs. Valid options are: -Format options, {
Voir également
JHtml::$formatOptions}. -groups: Boolean. If set, looks for keys with the value "&lt;optgroup>" and synthesizes groups from them. Deprecated. Defaults true for backwards compatibility. -list.select: either the value of one selected option or an array of selected options. Default: none. -list.translate: Boolean. If set, text and labels are translated via JText::_(). Default is false. -option.id: The property in each option array to use as the selection id attribute. Defaults to none. -option.key: The property in each option array to use as the selection value. Defaults to "value". If set to null, the index of the option array is used. -option.label: The property in each option array to use as the selection label attribute. Defaults to null (none). -option.text: The property in each option array to use as the displayed text. Defaults to "text". If set to null, the option array is assumed to be a list of displayable scalars. -option.attr: The property in each option array to use for additional selection attributes. Defaults to none. -option.disable: The property that will hold the disabled state. Defaults to "disable". -option.key: The property that will hold the selection value. Defaults to "value". -option.text: The property that will hold the the displayed text. Defaults to "text". If set to null, the option array is assumed to be a list of displayable scalars.
Paramètres
string$optTextThe name of the object variable for the option text.
mixed$selectedThe key that is selected (accepts an array or a string)
boolean$translateTranslate the option values.
Renvoie
string HTML for the select list
Depuis
1.5

Références $attr, $html, $id, $key, $label, $options, $selected, $text, elseif, et null.

◆ radiolist()

static radiolist (   $data,
  $name,
  $attribs = null,
  $optKey = 'value',
  $optText = 'text',
  $selected = null,
  $idtag = false,
  $translate = false 
)
static

Generates an HTML radio list.

Paramètres
array$dataAn array of objects
string$nameThe value of the HTML name attribute
string$attribsAdditional HTML attributes for the <select> tag
mixed$optKeyThe key that is selected
string$optTextThe name of the object variable for the option value
string$selectedThe name of the object variable for the option text
boolean$idtagValue of the field id or null by default
boolean$translateTrue if options will be translated
Renvoie
string HTML for the select list
Depuis
1.5

Références $attribs, $data, $html, $id, $name, $selected, et null.

◆ suggestionlist()

static suggestionlist (   $data,
  $optKey = 'value',
  $optText = 'text',
  $idtag = null,
  $translate = false 
)
static

Method to build a list with suggestions

Paramètres
array$dataAn array of objects, arrays, or values.
string$optKeyThe name of the object variable for the option value. If set to null, the index of the value array is used.
string$optTextThe name of the object variable for the option text.
mixed$idtagValue of the field id or null by default
boolean$translateTrue to translate
Renvoie
string HTML for the select list
Depuis
3.2
Obsolète:
4.0 Just create the <datalist> directly instead

Références $data, $html, $id, $options, et null.

Documentation des champs

◆ $optionDefaults

$optionDefaults
staticprotected
Valeur initiale :
= array(
'option' => array(
'option.attr' => null,
'option.disable' => 'disable',
'option.id' => null,
'option.key' => 'value',
'option.key.toHtml' => true,
'option.label' => null,
'option.label.toHtml' => true,
'option.text' => 'text',
'option.text.toHtml' => true,
'option.class' => 'class',
'option.onclick' => 'onclick',
),
)

La documentation de cette classe a été générée à partir du fichier suivant :