mTextBoxAriaLabel ) {
$defaultAttr[ 'aria-label' ] = $this->mTextBoxAriaLabel;
}
$class = $defaultAttr[ 'class' ] ?? '';
$class .= ' mw-ui-input mw-ui-input-inline';
$defaultAttr[ 'class' ] = $class;
return Html::element( 'input', $defaultAttr );
}
/**
* 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( $label, $name, $id, $value, $defaultAttr = [] ) {
$htmlOut = ' ';
$htmlOut .= Xml::element( 'input',
[
'type' => 'checkbox',
'name' => $name,
'value' => $value,
'id' => $id,
] + $defaultAttr
);
// Label
$htmlOut .= Xml::label( $label, $id );
$htmlOut .= '
';
return $htmlOut;
}
/**
* Factory method to help build submit button.
*
* @param array $defaultAttr
* @param bool $isProgressive (optional)
* @return string
*/
private function buildSubmitInput( $defaultAttr, $isProgressive = false ) {
$defaultAttr[ 'class' ] ??= '';
$defaultAttr[ 'class' ] .= ' mw-ui-button';
if ( $isProgressive ) {
$defaultAttr[ 'class' ] .= ' mw-ui-progressive';
}
$defaultAttr[ 'class' ] = trim( $defaultAttr[ 'class' ] );
return Xml::element( 'input', $defaultAttr );
}
private function bgColorStyle() {
if ( $this->mBGColor !== 'transparent' ) {
return 'background-color: ' . $this->mBGColor . ';';
}
return '';
}
/**
* Returns true, if the VisualEditor is requested from the inputbox wikitext definition and
* if the VisualEditor extension is actually installed or not, false otherwise.
*
* @return bool
*/
private function shouldUseVE() {
return ExtensionRegistry::getInstance()->isLoaded( 'VisualEditor' ) && $this->mUseVE !== null;
}
/**
* For compatability with pre T119158 behaviour
*
* If a field that is going to be used as an attribute
* and it contains "-{" in it, run it through language
* converter.
*
* Its not really clear if it would make more sense to
* always convert instead of only if -{ is present. This
* function just more or less restores the previous
* accidental behaviour.
*
* @see https://phabricator.wikimedia.org/T180485
* @param string $text
* @return string
*/
private function languageConvert( $text ) {
$langConv = $this->mParser->getTargetLanguageConverter();
if ( $langConv->hasVariants() && strpos( $text, '-{' ) !== false ) {
$text = $langConv->convert( $text );
}
return $text;
}
}