39 $info[
'nodata'] =
true;
43 parent::__construct( $info );
45 if ( isset( $info[
'flags'] ) ) {
46 $this->mFlags = $info[
'flags'];
49 if ( isset( $info[
'formnovalidate'] ) ) {
50 $this->mFormnovalidate = $info[
'formnovalidate'];
53 # Generate the label from a message, if possible
54 if ( isset( $info[
'buttonlabel-message'] ) ) {
55 $this->buttonLabel = $this->
getMessage( $info[
'buttonlabel-message'] )->parse();
56 } elseif ( isset( $info[
'buttonlabel'] ) ) {
57 if ( $info[
'buttonlabel'] ===
' ' || $info[
'buttonlabel'] ===
"\u{00A0}" ) {
59 $this->buttonLabel =
"\u{00A0}";
61 $this->buttonLabel = htmlspecialchars( $info[
'buttonlabel'] );
63 } elseif ( isset( $info[
'buttonlabel-raw'] ) ) {
64 $this->buttonLabel = $info[
'buttonlabel-raw'];
70 $prefix =
'mw-htmlform-';
72 $this->mParent->
getConfig()->get( MainConfigNames::UseMediaWikiUIEverywhere )
76 $flags .=
' ' . $prefix .
'button';
78 foreach ( $this->mFlags as $flag ) {
79 $flags .=
' ' . $prefix . $flag;
82 'class' =>
'mw-htmlform-submit ' . $this->mClass . $flags,
90 if ( $this->isBadIE() ) {
91 return Html::element(
'input', $attr );
93 return Html::rawElement(
'button', $attr,
94 $this->buttonLabel ?: htmlspecialchars( $this->
getDefault() ) );
105 return new OOUI\ButtonInputWidget( [
106 'name' => $this->mName,
108 'label' => !$this->isBadIE() && $this->buttonLabel
109 ?
new OOUI\HtmlSnippet( $this->buttonLabel )
115 'useInputTag' => $this->isBadIE(),
116 ] + OOUI\Element::configFromHtmlAttributes(
146 private function isBadIE() {
147 $request = $this->mParent
148 ? $this->mParent->getRequest()
149 : RequestContext::getMain()->getRequest();
150 return (
bool)preg_match(
'/MSIE [1-7]\./i', $request->getHeader(
'User-Agent' ) );
A class containing constants representing the names of configuration variables.