17 if ( isset(
$params[
'flatlist'] ) ) {
18 $this->mClass .=
' mw-htmlform-flatlist';
23 $p = parent::validate(
$value, $alldata );
30 return $this->
msg(
'htmlform-required' );
35 if ( in_array( strval(
$value ), $validOptions,
true ) ) {
38 return $this->
msg(
'htmlform-select-badoption' );
58 foreach ( $this->
getOptions() as $label => $data ) {
61 'label' => $this->mOptionsLabelsNotFromMessage ?
new OOUI\HtmlSnippet( $label ) : $label,
65 return new OOUI\RadioSelectInputWidget( [
66 'name' => $this->mName,
70 ] + OOUI\Element::configFromHtmlAttributes(
85 $elementFunc = [
'Html', $this->mOptionsLabelsNotFromMessage ?
'rawElement' :
'element' ];
87 # @todo Should this produce an unordered list perhaps?
88 foreach (
$options as $label => $info ) {
89 if ( is_array( $info ) ) {
90 $html .= Html::rawElement(
'h1', [], $label ) .
"\n";
93 $id = Sanitizer::escapeIdForAttribute( $this->mID .
"-$info" );
94 $classes = [
'mw-htmlform-flatlist-item' ];
96 $classes[] =
'mw-ui-radio';
98 $radio = Xml::radio( $this->mName, $info, $info ===
$value,
$attribs + [
'id' => $id ] );
99 $radio .=
' ' . call_user_func( $elementFunc,
'label', [
'for' => $id ], $label );
101 $html .=
' ' . Html::rawElement(
103 [
'class' => $classes ],
$wgUseMediaWikiUIEverywhere
Temporary variable that applies MediaWiki UI wherever it can be supported.
needsLabel()
Should this field have a label, or is there no input element with the appropriate id for the label to...
validate( $value, $alldata)
Override this function to add specific validation checks on the field input.
shouldInfuseOOUI()
Whether the field should be automatically infused.
formatOptions( $options, $value)
getInputHTML( $value)
This returns a block of all the radio options, in one cell.
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs