X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fwidget%2FTitlesMultiselectWidget.php;h=ac342596a8dc513d0e841bcb04f551d575ea3cc9;hb=6420c79320bc099cb4ff77232beabd72040146d0;hp=0a50fcd545d2ccb34956f4f207559f4ac691efb9;hpb=3be252f8cbc095a34ac450a516f0eb044b754f0e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/widget/TitlesMultiselectWidget.php b/includes/widget/TitlesMultiselectWidget.php index 0a50fcd545..ac342596a8 100644 --- a/includes/widget/TitlesMultiselectWidget.php +++ b/includes/widget/TitlesMultiselectWidget.php @@ -2,66 +2,33 @@ namespace MediaWiki\Widget; -use OOUI\MultilineTextInputWidget; - /** * Widget to select multiple titles. * * @copyright 2017 MediaWiki Widgets Team and others; see AUTHORS.txt * @license MIT */ -class TitlesMultiselectWidget extends \OOUI\Widget { +class TitlesMultiselectWidget extends TagMultiselectWidget { - protected $titlesArray = []; - protected $inputName = null; - protected $inputPlaceholder = null; - protected $tagLimit = null; protected $showMissing = null; + protected $excludeDynamicNamespaces = null; /** * @param array $config Configuration options - * - array $config['titles'] Array of titles to use as preset data - * - array $config['placeholder'] Placeholder message for input - * - array $config['name'] Name attribute (used in forms) - * - number $config['tagLimit'] Maximum number of selected titles * - bool $config['showMissing'] Show missing pages - * - array $config['input'] Config options for the input widget + * - bool $config['excludeDynamicNamespaces'] Exclude pages in negative namespaces */ public function __construct( array $config = [] ) { parent::__construct( $config ); // Properties - if ( isset( $config['default'] ) ) { - $this->titlesArray = $config['default']; - } - if ( isset( $config['name'] ) ) { - $this->inputName = $config['name']; - } - if ( isset( $config['placeholder'] ) ) { - $this->inputPlaceholder = $config['placeholder']; - } - if ( isset( $config['tagLimit'] ) ) { - $this->tagLimit = $config['tagLimit']; - } if ( isset( $config['showMissing'] ) ) { $this->showMissing = $config['showMissing']; } - if ( isset( $config['input'] ) ) { - $this->input = $config['input']; + if ( isset( $config['excludeDynamicNamespaces'] ) ) { + $this->excludeDynamicNamespaces = $config['excludeDynamicNamespaces']; } - $textarea = new MultilineTextInputWidget( array_merge( [ - 'name' => $this->inputName, - 'value' => implode( "\n", $this->titlesArray ), - 'rows' => 10, - 'classes' => [ - 'mw-widgets-titlesMultiselectWidget-multilineTextInputWidget' - ], - ], $this->input ) ); - - $pending = new PendingTextInputWidget(); - - $this->appendContent( $textarea, $pending ); $this->addClasses( [ 'mw-widgets-titlesMultiselectWidget' ] ); } @@ -70,26 +37,13 @@ class TitlesMultiselectWidget extends \OOUI\Widget { } public function getConfig( &$config ) { - if ( $this->titlesArray !== null ) { - $config['selected'] = $this->titlesArray; - } - if ( $this->inputName !== null ) { - $config['name'] = $this->inputName; - } - if ( $this->inputPlaceholder !== null ) { - $config['placeholder'] = $this->inputPlaceholder; - } - if ( $this->tagLimit !== null ) { - $config['tagLimit'] = $this->tagLimit; - } if ( $this->showMissing !== null ) { $config['showMissing'] = $this->showMissing; } - if ( $this->input !== null ) { - $config['input'] = $this->input; + if ( $this->excludeDynamicNamespaces !== null ) { + $config['excludeDynamicNamespaces'] = $this->excludeDynamicNamespaces; } - $config['$overlay'] = true; return parent::getConfig( $config ); }