$params['placeholder'] = $this->msg( 'mw-widgets-titlesmultiselect-placeholder' )->plain();
}
+ if ( isset( $this->mParams['max'] ) ) {
+ $params['limit'] = $this->mParams['max'];
+ }
+
+ if ( isset( $this->mParams['showMissing'] ) ) {
+ $params['showMissing'] = $this->mParams['showMissing'];
+ }
+
if ( !is_null( $value ) ) {
// $value is a string, but the widget expects an array
$params['default'] = $value === '' ? [] : explode( "\n", $value );
protected $titlesArray = [];
protected $inputName = null;
protected $inputPlaceholder = null;
+ protected $limit = null;
+ protected $showMissing = 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['limit'] Maximum number of selected titles
+ * - bool $config['showMissing'] Show missing pages
*/
public function __construct( array $config = [] ) {
parent::__construct( $config );
if ( isset( $config['placeholder'] ) ) {
$this->inputPlaceholder = $config['placeholder'];
}
+ if ( isset( $config['limit'] ) ) {
+ $this->limit = $config['limit'];
+ }
+ if ( isset( $config['showMissing'] ) ) {
+ $this->showMissing = $config['showMissing'];
+ }
$textarea = new MultilineTextInputWidget( [
'name' => $this->inputName,
if ( $this->inputPlaceholder !== null ) {
$config['placeholder'] = $this->inputPlaceholder;
}
+ if ( $this->limit !== null ) {
+ $config['limit'] = $this->limit;
+ }
+ if ( $this->showMissing !== null ) {
+ $config['showMissing'] = $this->showMissing;
+ }
$config['$overlay'] = true;
return parent::getConfig( $config );