Merge "Http::getProxy() method to get proxy configuration"
[lhc/web/wiklou.git] / includes / widget / SearchInputWidget.php
1 <?php
2 /**
3 * MediaWiki Widgets – SearchInputWidget class.
4 *
5 * @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt
6 * @license The MIT License (MIT); see LICENSE.txt
7 */
8 namespace MediaWiki\Widget;
9
10 /**
11 * Search input widget.
12 */
13 class SearchInputWidget extends TitleInputWidget {
14
15 protected $pushPending = false;
16 protected $validateTitle = false;
17 protected $highlightFirst = false;
18
19 /**
20 * @param array $config Configuration options
21 * @param int|null $config['pushPending'] Whether the input should be visually marked as
22 * "pending", while requesting suggestions (default: true)
23 */
24 public function __construct( array $config = [] ) {
25 // Parent constructor
26 parent::__construct(
27 array_merge( [
28 'infusable' => true,
29 'maxLength' => null,
30 'type' => 'search',
31 'icon' => 'search'
32 ], $config )
33 );
34
35 // Properties, which are ignored in PHP and just shipped back to JS
36 if ( isset( $config['pushPending'] ) ) {
37 $this->pushPending = $config['pushPending'];
38 }
39
40 // Initialization
41 $this->addClasses( [ 'mw-widget-searchInputWidget' ] );
42 }
43
44 protected function getJavaScriptClassName() {
45 return 'mw.widgets.SearchInputWidget';
46 }
47
48 public function getConfig( &$config ) {
49 $config['pushPending'] = $this->pushPending;
50 return parent::getConfig( $config );
51 }
52 }