diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-17 09:15:42 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-17 09:44:51 +0100 |
commit | a1789ddde42033f1b05cc4929491214ee6e79383 (patch) | |
tree | 63615735c4ddffaaabf2428946bb26f90899f7bf /includes/htmlform/HTMLButtonField.php | |
parent | 9e06a62f265e3a2aaabecc598d4bc617e06fa32d (diff) |
Update to MediaWiki 1.26.0
Diffstat (limited to 'includes/htmlform/HTMLButtonField.php')
-rw-r--r-- | includes/htmlform/HTMLButtonField.php | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/includes/htmlform/HTMLButtonField.php b/includes/htmlform/HTMLButtonField.php index 09c0ad97..56a23ad2 100644 --- a/includes/htmlform/HTMLButtonField.php +++ b/includes/htmlform/HTMLButtonField.php @@ -10,20 +10,54 @@ class HTMLButtonField extends HTMLFormField { protected $buttonType = 'button'; + /** @var array $mFlags Flags to add to OOUI Button widget */ + protected $mFlags = array(); + public function __construct( $info ) { $info['nodata'] = true; + if ( isset( $info['flags'] ) ) + $this->mFlags = $info['flags']; parent::__construct( $info ); } public function getInputHTML( $value ) { + $flags = ''; + $prefix = 'mw-htmlform-'; + if ( $this->mParent instanceof VFormHTMLForm || + $this->mParent->getConfig()->get( 'UseMediaWikiUIEverywhere' ) + ) { + $prefix = 'mw-ui-'; + // add mw-ui-button separately, so the descriptor doesn't need to set it + $flags .= ' ' . $prefix.'button'; + } + foreach ( $this->mFlags as $flag ) { + $flags .= ' ' . $prefix . $flag; + } $attr = array( - 'class' => 'mw-htmlform-submit ' . $this->mClass, + 'class' => 'mw-htmlform-submit ' . $this->mClass . $flags, 'id' => $this->mID, ) + $this->getAttributes( array( 'disabled', 'tabindex' ) ); return Html::input( $this->mName, $value, $this->buttonType, $attr ); } + /** + * Get the OOUI widget for this field. + * @param string $value + * @return OOUI\\ButtonInputWidget + */ + public function getInputOOUI( $value ) { + return new OOUI\ButtonInputWidget( array( + 'name' => $this->mName, + 'value' => $value, + 'label' => $value, + 'type' => $this->buttonType, + 'classes' => array( 'mw-htmlform-submit', $this->mClass ), + 'id' => $this->mID, + 'flags' => $this->mFlags, + ) + $this->getAttributes( array( 'disabled', 'tabindex' ), array( 'tabindex' => 'tabIndex' ) ) ); + } + protected function needsLabel() { return false; } |