protected $titlesArray = [];
protected $inputName = null;
protected $inputPlaceholder = null;
+ protected $tagLimit = null;
+ protected $showMissing = null;
/**
* @param array $config Configuration options
- * - array $config['titles'] Array of titles to use as preset data
+ * - array $config['default'] 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
*/
public function __construct( array $config = [] ) {
parent::__construct( $config );
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'];
+ }
- $textarea = new MultilineTextInputWidget( [
+ $textarea = new MultilineTextInputWidget( array_merge( [
'name' => $this->inputName,
'value' => implode( "\n", $this->titlesArray ),
'rows' => 10,
- ] );
- $this->appendContent( $textarea );
+ 'classes' => [
+ 'mw-widgets-titlesMultiselectWidget-multilineTextInputWidget'
+ ],
+ ], $this->input ) );
+
+ $pending = new PendingTextInputWidget();
+
+ $this->appendContent( $textarea, $pending );
$this->addClasses( [ 'mw-widgets-titlesMultiselectWidget' ] );
}
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;
+ }
$config['$overlay'] = true;
return parent::getConfig( $config );