40 $info[
'nodata'] =
true;
44 parent::__construct( $info );
46 if ( isset( $info[
'flags'] ) ) {
47 $this->mFlags = $info[
'flags'];
50 if ( isset( $info[
'formnovalidate'] ) ) {
51 $this->mFormnovalidate = $info[
'formnovalidate'];
54 # Generate the label from a message, if possible
55 if ( isset( $info[
'buttonlabel-message'] ) ) {
56 $this->buttonLabel = $this->
getMessage( $info[
'buttonlabel-message'] )->parse();
57 } elseif ( isset( $info[
'buttonlabel'] ) ) {
58 if ( $info[
'buttonlabel'] ===
' ' || $info[
'buttonlabel'] ===
"\u{00A0}" ) {
60 $this->buttonLabel =
"\u{00A0}";
62 $this->buttonLabel = htmlspecialchars( $info[
'buttonlabel'] );
64 } elseif ( isset( $info[
'buttonlabel-raw'] ) ) {
65 $this->buttonLabel = $info[
'buttonlabel-raw'];
71 $prefix =
'mw-htmlform-';
73 $this->mParent->
getConfig()->get( MainConfigNames::UseMediaWikiUIEverywhere )
77 $flags .=
' ' . $prefix .
'button';
79 foreach ( $this->mFlags as $flag ) {
80 $flags .=
' ' . $prefix . $flag;
83 'class' =>
'mw-htmlform-submit ' . $this->mClass . $flags,
91 if ( $this->isBadIE() ) {
92 return Html::element(
'input', $attr );
94 return Html::rawElement(
'button', $attr,
95 $this->buttonLabel ?: htmlspecialchars( $this->
getDefault() ) );
106 return new OOUI\ButtonInputWidget( [
107 'name' => $this->mName,
109 'label' => !$this->isBadIE() && $this->buttonLabel
110 ?
new OOUI\HtmlSnippet( $this->buttonLabel )
116 'useInputTag' => $this->isBadIE(),
117 ] + OOUI\Element::configFromHtmlAttributes(
147 private function isBadIE() {
148 $request = $this->mParent
149 ? $this->mParent->getRequest()
150 : RequestContext::getMain()->getRequest();
151 return (
bool)preg_match(
'/MSIE [1-7]\./i', $request->getHeader(
'User-Agent' ) );
A class containing constants representing the names of configuration variables.