protected $namespace = null;
protected $relative = null;
+ protected $suggestions = null;
/**
* @param array $config Configuration options
* @param int|null $config['namespace'] Namespace to prepend to queries
* @param bool|null $config['relative'] If a namespace is set, return a title relative to it (default: true)
+ * @param bool|null $config['suggestions'] Display search suggestions (default: true)
*/
public function __construct( array $config = array() ) {
// Parent constructor
if ( isset( $config['namespace'] ) ) {
$this->namespace = $config['namespace'];
}
-
if ( isset( $config['relative'] ) ) {
$this->relative = $config['relative'];
}
+ if ( isset( $config['suggestions'] ) ) {
+ $this->suggestions = $config['suggestions'];
+ }
// Initialization
$this->addClasses( array( 'mw-widget-titleInputWidget' ) );
if ( $this->relative !== null ) {
$config['relative'] = $this->relative;
}
+ if ( $this->suggestions !== null ) {
+ $config['suggestions'] = $this->suggestions;
+ }
return parent::getConfig( $config );
}
}
* @cfg {number} [limit=10] Number of results to show
* @cfg {number} [namespace] Namespace to prepend to queries
* @cfg {boolean} [relative=true] If a namespace is set, return a title relative to it
+ * @cfg {boolean} [suggestions=true] Display search suggestions
* @cfg {boolean} [showRedirectTargets=true] Show the targets of redirects
* @cfg {boolean} [showRedlink] Show red link to exact match if it doesn't exist
* @cfg {boolean} [showImages] Show page images
this.limit = config.limit || 10;
this.namespace = config.namespace !== undefined ? config.namespace : null;
this.relative = config.relative !== undefined ? config.relative : true;
+ this.suggestions = config.suggestions !== undefined ? config.suggestions : true;
this.showRedirectTargets = config.showRedirectTargets !== false;
this.showRedlink = !!config.showRedlink;
this.showImages = !!config.showImages;
if ( this.showDescriptions ) {
this.lookupMenu.$element.addClass( 'mw-widget-titleInputWidget-menu-withDescriptions' );
}
+ this.setLookupsDisabled( !this.suggestions );
this.interwikiPrefixes = [];
this.interwikiPrefixesPromise = new mw.Api().get( {
this.closeLookupMenu();
this.setLookupsDisabled( true );
this.setValue( item.getData() );
- this.setLookupsDisabled( false );
+ this.setLookupsDisabled( !this.suggestions );
};
/**
// Parent method
retval = mw.widgets.TitleInputWidget.parent.prototype.focus.apply( this, arguments );
- this.setLookupsDisabled( false );
+ this.setLookupsDisabled( !this.suggestions );
return retval;
};