From afd67e7bfc46ff3cca9972fc4673db83773434b4 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 19 Nov 2015 22:21:15 +0100 Subject: [PATCH] Fix conflicting configuration name in TitleInputWidget config.validate is already given and used in OO.ui.TextInputWidget to define a string/regex/method where a query is checked against. TitleInputWidget would override it with a config option to enable/disable this check. The config option "validate" uses the "validateTitle" name, now. There was no usage so far. Follow up: I732a2f56a2375d8c708e3b295996187ee209f1a6 Bug: T119075 Change-Id: Ibb47b20506d21213fc9681b6aa919ce45505e474 --- includes/widget/TitleInputWidget.php | 13 +++++++------ .../src/mediawiki.widgets/mw.widgets.TitleWidget.js | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/includes/widget/TitleInputWidget.php b/includes/widget/TitleInputWidget.php index 8226148c15..c262b40b79 100644 --- a/includes/widget/TitleInputWidget.php +++ b/includes/widget/TitleInputWidget.php @@ -16,7 +16,7 @@ class TitleInputWidget extends \OOUI\TextInputWidget { protected $relative = null; protected $suggestions = null; protected $highlightFirst = null; - protected $validate = null; + protected $validateTitle = null; /** * @param array $config Configuration options @@ -26,7 +26,8 @@ class TitleInputWidget extends \OOUI\TextInputWidget { * @param bool|null $config['suggestions'] Display search suggestions (default: true) * @param bool|null $config['highlightFirst'] Automatically highlight * the first result (default: true) - * @param bool|null $config['validate'] Whether the input must be a valid title (default: true) + * @param bool|null $config['validateTitle'] Whether the input must + * be a valid title (default: true) */ public function __construct( array $config = array() ) { // Parent constructor @@ -47,8 +48,8 @@ class TitleInputWidget extends \OOUI\TextInputWidget { if ( isset( $config['highlightFirst'] ) ) { $this->highlightFirst = $config['highlightFirst']; } - if ( isset( $config['validate'] ) ) { - $this->validate = $config['validate']; + if ( isset( $config['validateTitle'] ) ) { + $this->validateTitle = $config['validateTitle']; } // Initialization @@ -72,8 +73,8 @@ class TitleInputWidget extends \OOUI\TextInputWidget { if ( $this->highlightFirst !== null ) { $config['highlightFirst'] = $this->highlightFirst; } - if ( $this->validate !== null ) { - $config['validate'] = $this->validate; + if ( $this->validateTitle !== null ) { + $config['validateTitle'] = $this->validateTitle; } return parent::getConfig( $config ); } diff --git a/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js b/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js index 84732aab19..abe1228cf4 100644 --- a/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js +++ b/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js @@ -23,7 +23,7 @@ * @cfg {boolean} [showRedlink] Show red link to exact match if it doesn't exist * @cfg {boolean} [showImages] Show page images * @cfg {boolean} [showDescriptions] Show page descriptions - * @cfg {boolean} [validate=true] Whether the input must be a valid title + * @cfg {boolean} [validateTitle=true] Whether the input must be a valid title * @cfg {Object} [cache] Result cache which implements a 'set' method, taking keyed values as an argument */ mw.widgets.TitleWidget = function MwWidgetsTitleWidget( config ) { @@ -45,7 +45,7 @@ this.showRedlink = !!config.showRedlink; this.showImages = !!config.showImages; this.showDescriptions = !!config.showDescriptions; - this.validate = config.validate !== undefined ? config.validate : true; + this.validateTitle = config.validateTitle !== undefined ? config.validateTitle : true; this.cache = config.cache; // Initialization @@ -287,7 +287,7 @@ * @return {boolean} The query is valid */ mw.widgets.TitleWidget.prototype.isQueryValid = function () { - return this.validate ? !!this.getTitle() : true; + return this.validateTitle ? !!this.getTitle() : true; }; }( jQuery, mediaWiki ) ); -- 2.20.1