X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMWNamespace.php;h=e03a29b80f08f68dbf59ec10f7f7c6411cfefd98;hb=2d75c56c17aa93fc52c79ee6cc1d6f3653a80d1b;hp=73fdd826eb80121601c435e5d7c40f1c234f7791;hpb=0f1858321c37f48d8c01d0d113e99d4441d14594;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MWNamespace.php b/includes/MWNamespace.php index 73fdd826eb..e03a29b80f 100644 --- a/includes/MWNamespace.php +++ b/includes/MWNamespace.php @@ -477,7 +477,7 @@ class MWNamespace { * * @since 1.23 * @param int $index Index to check - * @param User $user User to check + * @param User|null $user User to check * @return array */ public static function getRestrictionLevels( $index, User $user = null ) { @@ -540,4 +540,26 @@ class MWNamespace { return $usableLevels; } + + /** + * Returns the link type to be used for categories. + * + * This determines which section of a category page titles + * in the namespace will appear within. + * + * @since 1.32 + * @param int $index Namespace index + * @return string One of 'subcat', 'file', 'page' + */ + public static function getCategoryLinkType( $index ) { + self::isMethodValidFor( $index, __METHOD__ ); + + if ( $index == NS_CATEGORY ) { + return 'subcat'; + } elseif ( $index == NS_FILE ) { + return 'file'; + } else { + return 'page'; + } + } }