22 $value = $request->getText( $this->mName, $this->
getDefault() ??
'' );
24 $namespaces = explode(
"\n", $value );
26 $namespaces = array_values( array_filter( $namespaces,
static function ( $namespace ) {
27 return trim( $namespace ) !==
'';
30 return implode(
"\n", $namespaces );
34 if ( !$this->mParams[
'exists'] || $value ===
'' ) {
38 if ( $value ===
null ) {
43 $namespaces = explode(
"\n", $value );
45 if ( isset( $this->mParams[
'max'] ) && ( count( $namespaces ) > $this->mParams[
'max'] ) ) {
46 return $this->
msg(
'htmlform-multiselect-toomany', $this->mParams[
'max'] );
49 foreach ( $namespaces as $namespace ) {
54 return $this->
msg(
'htmlform-select-badoption' );
57 $result = parent::validate( $namespace, $alldata );
58 if ( $result !==
true ) {
67 $this->mParent->getOutput()->enableOOUI();
72 $this->mParent->getOutput()->addModuleStyles(
'mediawiki.widgets.TagMultiselectWidget.styles' );
80 if ( isset( $this->mParams[
'disabled'] ) ) {
81 $params[
'disabled'] = $this->mParams[
'disabled'];
84 if ( isset( $this->mParams[
'default'] ) ) {
85 $params[
'default'] = $this->mParams[
'default'];
88 $params[
'placeholder'] = $this->mParams[
'placeholder'] ??
89 $this->
msg(
'mw-widgets-titlesmultiselect-placeholder' )->plain();
91 if ( isset( $this->mParams[
'max'] ) ) {
92 $params[
'tagLimit'] = $this->mParams[
'max'];
95 if ( isset( $this->mParams[
'input'] ) ) {
96 $params[
'input'] = $this->mParams[
'input'];
99 if ( isset( $this->mParams[
'allowEditTags'] ) ) {
100 $params[
'allowEditTags'] = $this->mParams[
'allowEditTags'];
103 if ( $value !==
null ) {
105 $params[
'default'] = $value ===
'' ? [] : explode(
"\n", $value );
110 $params[
'classes'] = [
'mw-htmlform-autoinfuse' ];
112 $widget->setAttributes( [
'data-mw-modules' => implode(
',', $this->
getOOUIModules() ) ] );
122 return [
'mediawiki.widgets.NamespacesMultiselectWidget' ];
129 return $textAreaField->getInputCodex( $value, $hasErrors );
135class_alias( HTMLNamespacesMultiselectField::class,
'HTMLNamespacesMultiselectField' );
array $params
The job parameters.