Merge "ApiQueryRevisions: Fix error message key"
[lhc/web/wiklou.git] / includes / widget / SearchInputWidget.php
index 6fed794..2f0c23d 100644 (file)
@@ -10,16 +10,14 @@ namespace MediaWiki\Widget;
  */
 class SearchInputWidget extends TitleInputWidget {
 
-       protected $pushPending = false;
        protected $performSearchOnClick = true;
        protected $validateTitle = false;
        protected $highlightFirst = false;
        protected $dataLocation = 'header';
+       protected $showDescriptions = false;
 
        /**
         * @param array $config Configuration options
-        *   - int|null $config['pushPending'] Whether the input should be visually marked as
-        *     "pending", while requesting suggestions (default: false)
         *   - bool|null $config['performSearchOnClick'] If true, the script will start a search
         *     whenever a user hits a suggestion. If false, the text of the suggestion is inserted into
         *     the text field only (default: true)
@@ -35,10 +33,6 @@ class SearchInputWidget extends TitleInputWidget {
                parent::__construct( $config );
 
                // Properties, which are ignored in PHP and just shipped back to JS
-               if ( isset( $config['pushPending'] ) ) {
-                       $this->pushPending = $config['pushPending'];
-               }
-
                if ( isset( $config['performSearchOnClick'] ) ) {
                        $this->performSearchOnClick = $config['performSearchOnClick'];
                }
@@ -48,6 +42,10 @@ class SearchInputWidget extends TitleInputWidget {
                        $this->dataLocation = $config['dataLocation'];
                }
 
+               if ( !empty( $config['showDescriptions'] ) ) {
+                       $this->showDescriptions = true;
+               }
+
                // Initialization
                $this->addClasses( [ 'mw-widget-searchInputWidget' ] );
        }
@@ -61,11 +59,13 @@ class SearchInputWidget extends TitleInputWidget {
        }
 
        public function getConfig( &$config ) {
-               $config['pushPending'] = $this->pushPending;
                $config['performSearchOnClick'] = $this->performSearchOnClick;
                if ( $this->dataLocation ) {
                        $config['dataLocation'] = $this->dataLocation;
                }
+               if ( $this->showDescriptions ) {
+                       $config['showDescriptions'] = true;
+               }
                $config['$overlay'] = true;
                return parent::getConfig( $config );
        }