aboutsummaryrefslogtreecommitdiffstats
path: root/includes/MWNamespace.php
diff options
context:
space:
mode:
authordaniel <dkinzler@wikimedia.org>2018-11-19 12:39:56 +0100
committerdaniel <dkinzler@wikimedia.org>2018-11-30 12:29:05 -0800
commitdb987c700adfe8766316d56f2b4e05935e09d6a4 (patch)
tree874aff9f7995412f015102e79b25008a90f004aa /includes/MWNamespace.php
parent38dfb025e5c95f450c55de36f4e5dbaf8800e3b4 (diff)
downloadmediawikicore-db987c700adfe8766316d56f2b4e05935e09d6a4.tar.gz
mediawikicore-db987c700adfe8766316d56f2b4e05935e09d6a4.zip
[MCR] Introduce SlotRoleHandler and SlotRoleRegistry
These new classes provide a mechanism for defining the behavior of slots, like the content models it supports. This acts as an extension point for extensions that need to define custom slots, like the MediaInfo extension for the SDC project. Bug: T194046 Change-Id: Ia20c98eee819293199e541be75b5521f6413bc2f
Diffstat (limited to 'includes/MWNamespace.php')
-rw-r--r--includes/MWNamespace.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/includes/MWNamespace.php b/includes/MWNamespace.php
index e03a29b80f08..98e70bf9f753 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;
}
/**