X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMWNamespace.php;h=98e70bf9f753f3635da2c957ce9cb6d9bb2583de;hb=5a1f6dbe6343e76b510537976b17aa8288698aa5;hp=e03a29b80f08f68dbf59ec10f7f7c6411cfefd98;hpb=216865344b108082f9500b5eb8cd5efeaa7df72f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MWNamespace.php b/includes/MWNamespace.php index e03a29b80f..98e70bf9f7 100644 --- a/includes/MWNamespace.php +++ b/includes/MWNamespace.php @@ -19,6 +19,7 @@ * * @file */ +use MediaWiki\MediaWikiServices; /** * This is a utility class with only static functions @@ -462,13 +463,17 @@ class MWNamespace { * Get the default content model for a namespace * This does not mean that all pages in that namespace have the model * + * @note To determine the default model for a new page's main slot, or any slot in general, + * use SlotRoleHandler::getDefaultModel() together with SlotRoleRegistry::getRoleHandler(). + * * @since 1.21 * @param int $index Index to check * @return null|string Default model name for the given namespace, if set */ public static function getNamespaceContentModel( $index ) { - global $wgNamespaceContentModels; - return $wgNamespaceContentModels[$index] ?? null; + $config = MediaWikiServices::getInstance()->getMainConfig(); + $models = $config->get( 'NamespaceContentModels' ); + return $models[$index] ?? null; } /**