Display namespace name instead of its ID in checkboxes' labels

This fixes change 3bf7584c51 where after that, "nsN" is label for checkbox instead of human-readable name, as previous behaviour.

Bug: T362458
Change-Id: Iefa31ebf3759a9bf53d66c3b3c6f5e7dd76f4178
This commit is contained in:
Wargo 2024-04-14 10:46:44 +00:00
parent 05ea25e6ec
commit dc5c785212

View file

@ -292,7 +292,7 @@ class InputBox {
} else {
// Checkbox
$htmlOut .= $this->buildCheckboxInput(
'ns' . $i, 'mw-inputbox-ns' . $i . $idRandStr, "1", $checked
$name, 'ns' . $i, 'mw-inputbox-ns' . $i . $idRandStr, "1", $checked
);
}
}
@ -762,13 +762,14 @@ REGEX;
/**
* Factory method to help build checkbox input.
*
* @param string $label text displayed next to checkbox (label)
* @param string $name name of input
* @param string $id id of input
* @param string $value value of input
* @param array $defaultAttr (optional)
* @return string
*/
private function buildCheckboxInput( $name, $id, $value, $defaultAttr = [] ) {
private function buildCheckboxInput( $label, $name, $id, $value, $defaultAttr = [] ) {
$htmlOut = ' <div class="mw-inputbox-element mw-ui-checkbox">';
$htmlOut .= Xml::element( 'input',
[
@ -779,7 +780,7 @@ REGEX;
] + $defaultAttr
);
// Label
$htmlOut .= Xml::label( $name, $id );
$htmlOut .= Xml::label( $label, $id );
$htmlOut .= '</div> ';
return $htmlOut;
}