Merge "ContextSource::getContext() can return any IContextSource"
[lhc/web/wiklou.git] / includes / htmlform / HTMLSelectAndOtherField.php
index 4f501f7..65176dd 100644 (file)
@@ -16,7 +16,7 @@ class HTMLSelectAndOtherField extends HTMLSelectField {
                } elseif ( array_key_exists( 'other-message', $params ) ) {
                        $params['other'] = wfMessage( $params['other-message'] )->plain();
                } else {
-                       $params['other'] = null;
+                       $params['other'] = wfMessage( 'htmlform-selectorother-other' )->plain();
                }
 
                parent::__construct( $params );
@@ -26,7 +26,8 @@ class HTMLSelectAndOtherField extends HTMLSelectField {
                        throw new MWException( 'HTMLSelectAndOtherField called without any options' );
                }
                if ( !in_array( 'other', $this->mOptions, true ) ) {
-                       $this->mOptions[$params['other']] = 'other';
+                       // Have 'other' always as first element
+                       $this->mOptions = array( $params['other'] => 'other' ) + $this->mOptions;
                }
                $this->mFlatOptions = self::flattenOptions( $this->getOptions() );
 
@@ -60,9 +61,9 @@ class HTMLSelectAndOtherField extends HTMLSelectField {
        }
 
        /**
-        * @param $request WebRequest
+        * @param WebRequest $request
         *
-        * @return Array("<overall message>","<select value>","<text field value>")
+        * @return array("<overall message>","<select value>","<text field value>")
         */
        function loadDataFromRequest( $request ) {
                if ( $request->getCheck( $this->mName ) ) {