<?php
use MediaWiki\Widget\NamespacesMultiselectWidget;
+use MediaWiki\MediaWikiServices;
/**
* Implements a tag multiselect input field for namespaces.
}
public function validate( $value, $alldata ) {
- if ( !$this->mParams['exists'] ) {
+ if ( !$this->mParams['exists'] || $value === '' ) {
return true;
}
}
foreach ( $namespaces as $namespace ) {
- if ( $namespace < 0 ) {
+ if (
+ $namespace < 0 ||
+ !MediaWikiServices::getInstance()->getNamespaceInfo()->exists( $namespace )
+ ) {
return $this->msg( 'htmlform-select-badoption' );
}