2015-07-17 22:04:02 +00:00
|
|
|
<?php
|
2017-12-28 15:17:33 +00:00
|
|
|
|
2015-07-17 22:04:02 +00:00
|
|
|
namespace MediaWiki\Widget;
|
|
|
|
|
|
2024-01-02 18:31:56 +00:00
|
|
|
use OOUI\TextInputWidget;
|
|
|
|
|
|
2015-07-17 22:04:02 +00:00
|
|
|
/**
|
|
|
|
|
* User input widget.
|
2017-12-28 15:17:33 +00:00
|
|
|
*
|
|
|
|
|
* @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt
|
|
|
|
|
* @license MIT
|
2015-07-17 22:04:02 +00:00
|
|
|
*/
|
2024-01-02 18:31:56 +00:00
|
|
|
class UserInputWidget extends TextInputWidget {
|
2024-07-17 22:26:54 +00:00
|
|
|
/** @var bool */
|
|
|
|
|
protected $excludeNamed;
|
|
|
|
|
|
|
|
|
|
/** @var bool */
|
|
|
|
|
protected $excludeTemp;
|
2015-07-22 00:01:16 +00:00
|
|
|
|
2015-07-17 22:04:02 +00:00
|
|
|
/**
|
|
|
|
|
* @param array $config Configuration options
|
|
|
|
|
*/
|
2016-02-17 09:09:32 +00:00
|
|
|
public function __construct( array $config = [] ) {
|
2016-07-26 11:56:47 +00:00
|
|
|
parent::__construct( $config );
|
2015-07-17 22:04:02 +00:00
|
|
|
|
2024-07-17 22:26:54 +00:00
|
|
|
if ( isset( $config['excludenamed'] ) ) {
|
|
|
|
|
$this->excludeNamed = $config['excludenamed'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( isset( $config['excludetemp'] ) ) {
|
|
|
|
|
$this->excludeTemp = $config['excludetemp'];
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-17 22:04:02 +00:00
|
|
|
// Initialization
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->addClasses( [ 'mw-widget-userInputWidget' ] );
|
2015-07-17 22:04:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function getJavaScriptClassName() {
|
|
|
|
|
return 'mw.widgets.UserInputWidget';
|
|
|
|
|
}
|
2018-01-02 22:25:01 +00:00
|
|
|
|
|
|
|
|
public function getConfig( &$config ) {
|
|
|
|
|
$config['$overlay'] = true;
|
2024-07-17 22:26:54 +00:00
|
|
|
|
|
|
|
|
if ( $this->excludeNamed !== null ) {
|
|
|
|
|
$config['excludenamed'] = $this->excludeNamed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( $this->excludeTemp !== null ) {
|
|
|
|
|
$config['excludetemp'] = $this->excludeTemp;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-02 22:25:01 +00:00
|
|
|
return parent::getConfig( $config );
|
|
|
|
|
}
|
2015-07-17 22:04:02 +00:00
|
|
|
}
|