MediaWiki master
MediaWiki\Xml\XmlSelect Class Reference

Class for generating HTML <select> or <datalist> elements. More...

Public Member Functions

 __construct ( $name=false, $id=false, $default=false)
 
 addOption (string $label, $value=false)
 
 addOptions (array $options)
 This accepts an array of form label => value label => ( label => value, label => value )
 
 getAttribute (string $name)
 
 getHTML ()
 
 setAttribute (string $name, $value)
 
 setDefault ( $default)
 
 setTagName (string $tagName)
 

Static Public Member Functions

static formatOptions (array $options, $default=false)
 This accepts an array of form: label => value label => ( label => value, label => value )
 
static parseOptionsMessage (string $msg)
 Parse labels and values out of a comma- and colon-separated list of options, such as is used for expiry and duration lists.
 

Detailed Description

Class for generating HTML <select> or <datalist> elements.

Definition at line 16 of file XmlSelect.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Xml\XmlSelect::__construct ( $name = false,
$id = false,
$default = false )
Parameters
string | false$name
string | false$id
string | int | float | array | false$default

Definition at line 30 of file XmlSelect.php.

References MediaWiki\Xml\XmlSelect\setAttribute().

Member Function Documentation

◆ addOption()

MediaWiki\Xml\XmlSelect::addOption ( string $label,
$value = false )
Parameters
string$label
string | int | float | array | false$valueIf not given, assumed equal to $label

Definition at line 77 of file XmlSelect.php.

◆ addOptions()

MediaWiki\Xml\XmlSelect::addOptions ( array $options)

This accepts an array of form label => value label => ( label => value, label => value )

Parameters
array<string,string|int|float|array>$options

Definition at line 89 of file XmlSelect.php.

◆ formatOptions()

static MediaWiki\Xml\XmlSelect::formatOptions ( array $options,
$default = false )
static

This accepts an array of form: label => value label => ( label => value, label => value )

Parameters
array<string,string|int|float|array>$options
string | int | float | array | false$default
Returns
string HTML

Definition at line 102 of file XmlSelect.php.

◆ getAttribute()

MediaWiki\Xml\XmlSelect::getAttribute ( string $name)
Parameters
string$name
Returns
string|int|null

Definition at line 69 of file XmlSelect.php.

◆ getHTML()

MediaWiki\Xml\XmlSelect::getHTML ( )

Definition at line 121 of file XmlSelect.php.

◆ parseOptionsMessage()

static MediaWiki\Xml\XmlSelect::parseOptionsMessage ( string $msg)
static

Parse labels and values out of a comma- and colon-separated list of options, such as is used for expiry and duration lists.

Documentation of the format is on translatewiki.net.

Since
1.35 string $msg The message to parse. array<string,string> The options array, where keys are option labels (i.e. translations) and values are option values (i.e. untranslated).

Definition at line 140 of file XmlSelect.php.

◆ setAttribute()

MediaWiki\Xml\XmlSelect::setAttribute ( string $name,
$value )
Parameters
string$name
string | int$value

Definition at line 61 of file XmlSelect.php.

Referenced by MediaWiki\Xml\XmlSelect\__construct().

◆ setDefault()

MediaWiki\Xml\XmlSelect::setDefault ( $default)
Parameters
string | int | float | array$default

Definition at line 45 of file XmlSelect.php.

◆ setTagName()

MediaWiki\Xml\XmlSelect::setTagName ( string $tagName)
Deprecated
since 1.45

Definition at line 52 of file XmlSelect.php.


The documentation for this class was generated from the following file: