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-';
74 ( !$isCodexForm && $this->mParent->getConfig()->get( MainConfigNames::UseMediaWikiUIEverywhere ) )
78 $flags .=
' ' . $prefix .
'button';
81 $flags .=
' cdx-button cdx-button--action-progressive cdx-button--weight-primary';
83 foreach ( $this->mFlags as $flag ) {
84 $flags .=
' ' . $prefix . $flag;
87 'class' =>
'mw-htmlform-submit ' . $this->mClass . $flags,
95 if ( $this->isBadIE() ) {
96 return Html::element(
'input', $attr );
98 return Html::rawElement(
'button', $attr,
99 $this->buttonLabel ?: htmlspecialchars( $this->
getDefault() ) );
110 return new OOUI\ButtonInputWidget( [
111 'name' => $this->mName,
113 'label' => !$this->isBadIE() && $this->buttonLabel
114 ?
new OOUI\HtmlSnippet( $this->buttonLabel )
120 'useInputTag' => $this->isBadIE(),
121 ] + OOUI\Element::configFromHtmlAttributes(
151 private function isBadIE() {
152 $request = $this->mParent
153 ? $this->mParent->getRequest()
154 : RequestContext::getMain()->getRequest();
155 return (
bool)preg_match(
'/MSIE [1-7]\./i', $request->getHeader(
'User-Agent' ) );
A class containing constants representing the names of configuration variables.