summaryrefslogtreecommitdiff
path: root/includes/htmlform/HTMLSelectAndOtherField.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-06-04 07:31:04 +0200
committerPierre Schmitz <pierre@archlinux.de>2015-06-04 07:58:39 +0200
commitf6d65e533c62f6deb21342d4901ece24497b433e (patch)
treef28adf0362d14bcd448f7b65a7aaf38650f923aa /includes/htmlform/HTMLSelectAndOtherField.php
parentc27b2e832fe25651ef2410fae85b41072aae7519 (diff)
Update to MediaWiki 1.25.1
Diffstat (limited to 'includes/htmlform/HTMLSelectAndOtherField.php')
-rw-r--r--includes/htmlform/HTMLSelectAndOtherField.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/includes/htmlform/HTMLSelectAndOtherField.php b/includes/htmlform/HTMLSelectAndOtherField.php
index 65176dd7..a1c0c957 100644
--- a/includes/htmlform/HTMLSelectAndOtherField.php
+++ b/includes/htmlform/HTMLSelectAndOtherField.php
@@ -13,6 +13,7 @@
class HTMLSelectAndOtherField extends HTMLSelectField {
function __construct( $params ) {
if ( array_key_exists( 'other', $params ) ) {
+ // Do nothing
} elseif ( array_key_exists( 'other-message', $params ) ) {
$params['other'] = wfMessage( $params['other-message'] )->plain();
} else {
@@ -22,7 +23,7 @@ class HTMLSelectAndOtherField extends HTMLSelectField {
parent::__construct( $params );
if ( $this->getOptions() === null ) {
- # Sulk
+ // Sulk
throw new MWException( 'HTMLSelectAndOtherField called without any options' );
}
if ( !in_array( 'other', $this->mOptions, true ) ) {
@@ -39,10 +40,12 @@ class HTMLSelectAndOtherField extends HTMLSelectField {
$textAttribs = array(
'id' => $this->mID . '-other',
'size' => $this->getSize(),
+ 'class' => array( 'mw-htmlform-select-and-other-field' ),
+ 'data-id-select' => $this->mID,
);
if ( $this->mClass !== '' ) {
- $textAttribs['class'] = $this->mClass;
+ $textAttribs['class'][] = $this->mClass;
}
$allowedParams = array(
@@ -50,7 +53,8 @@ class HTMLSelectAndOtherField extends HTMLSelectField {
'autofocus',
'multiple',
'disabled',
- 'tabindex'
+ 'tabindex',
+ 'maxlength', // gets dynamic with javascript, see mediawiki.htmlform.js
);
$textAttribs += $this->getAttributes( $allowedParams );
@@ -71,6 +75,7 @@ class HTMLSelectAndOtherField extends HTMLSelectField {
$list = $request->getText( $this->mName );
$text = $request->getText( $this->mName . '-other' );
+ // Should be built the same as in mediawiki.htmlform.js
if ( $list == 'other' ) {
$final = $text;
} elseif ( !in_array( $list, $this->mFlatOptions, true ) ) {