mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 00:00:49 +00:00
Merge "Treat ambiguous values in $wgVisualEditorAvailableNamespaces as names"
This commit is contained in:
commit
aeeffb912a
|
@ -648,9 +648,12 @@ class ApiVisualEditor extends ApiBase {
|
|||
(array)ExtensionRegistry::getInstance()->getAttribute( 'VisualEditorAvailableNamespaces' );
|
||||
return array_values( array_unique( array_map( function ( $namespace ) {
|
||||
// Convert canonical namespace names to IDs
|
||||
return is_numeric( $namespace ) ?
|
||||
$namespace :
|
||||
MWNamespace::getCanonicalIndex( strtolower( $namespace ) );
|
||||
$idFromName = MWNamespace::getCanonicalIndex( strtolower( $namespace ) );
|
||||
if ( $idFromName !== null ) {
|
||||
return $idFromName;
|
||||
}
|
||||
// Allow namespaces to be specified by ID as well
|
||||
return MWNamespace::exists( $namespace ) ? $namespace : null;
|
||||
}, array_keys( array_filter( $availableNamespaces ) ) ) ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue