+ /**
+ * Set the value from outside.
+ *
+ * @param {string|undefined} value
+ */
+ mw.widgets.SelectWithInputWidget.prototype.setValue = function ( value ) {
+ var selectable = false;
+
+ if ( this.or ) {
+ if ( value !== 'other' ) {
+ selectable = !!this.dropdowninput.dropdownWidget.getMenu().findItemFromData( value );
+ }
+
+ if ( selectable ) {
+ this.dropdowninput.setValue( value );
+ this.textinput.setValue( undefined );
+ } else {
+ this.dropdowninput.setValue( 'other' );
+ this.textinput.setValue( value );
+ }
+
+ this.emit( 'change', value );
+ }
+ };
+
+ /**
+ * Get the value from outside.
+ *
+ * @return {string}
+ */
+ mw.widgets.SelectWithInputWidget.prototype.getValue = function () {
+ if ( this.or ) {
+ if ( this.dropdowninput.getValue() !== 'other' ) {
+ return this.dropdowninput.getValue();
+ }
+
+ return this.textinput.getValue();
+ } else {
+ return '';
+ }
+ };
+