MediaWiki  master
Revision\MainSlotRoleHandler Class Reference

A SlotRoleHandler for the main slot. More...

Inheritance diagram for Revision\MainSlotRoleHandler:
Collaboration diagram for Revision\MainSlotRoleHandler:

Public Member Functions

 __construct (array $namespaceContentModels)
 
 getDefaultModel (LinkTarget $page)
 
 isAllowedModel ( $model, LinkTarget $page)
 
 supportsArticleCount ()
 
- Public Member Functions inherited from Revision\SlotRoleHandler
 __construct ( $role, $contentModel, $layout=[])
 
 getDefaultModel (LinkTarget $page)
 Determines the content model to use per default for this slot on the given page. More...
 
 getNameMessageKey ()
 The message key for the translation of the slot name. More...
 
 getOutputLayoutHints ()
 Layout hints for use while laying out the combined output of all slots, typically by RevisionRenderer. More...
 
 getRole ()
 
 isAllowedModel ( $model, LinkTarget $page)
 Determines whether the given model can be used on this slot on the given page. More...
 
 supportsArticleCount ()
 Whether this slot should be considered when determining whether a page should be counted as an "article" in the site statistics. More...
 

Private Attributes

string [] $namespaceContentModels
 A mapping of namespaces to content models. More...
 

Detailed Description

A SlotRoleHandler for the main slot.

While most slot roles serve a specific purpose and thus typically exhibit the same behaviour on all pages, the main slot is used for different things in different pages, typically depending on the namespace, a "file extension" in the page name, or the content model of the slot's content.

MainSlotRoleHandler implements some of the per-namespace and per-model behavior that was supported prior to MediaWiki Version 1.33.

Since
1.33

Definition at line 41 of file MainSlotRoleHandler.php.

Constructor & Destructor Documentation

◆ __construct()

Revision\MainSlotRoleHandler::__construct ( array  $namespaceContentModels)
Parameters
string[]$namespaceContentModels A mapping of namespaces to content models, typically from $wgNamespaceContentModels.

Definition at line 53 of file MainSlotRoleHandler.php.

References Revision\MainSlotRoleHandler\$namespaceContentModels, and CONTENT_MODEL_WIKITEXT.

Member Function Documentation

◆ getDefaultModel()

Revision\MainSlotRoleHandler::getDefaultModel ( LinkTarget  $page)

◆ isAllowedModel()

Revision\MainSlotRoleHandler::isAllowedModel (   $model,
LinkTarget  $page 
)
Parameters
string$model
LinkTarget$page
Returns
bool

Definition at line 68 of file MainSlotRoleHandler.php.

References $title, ContentHandler\getForModelID(), and Title\newFromLinkTarget().

◆ supportsArticleCount()

Revision\MainSlotRoleHandler::supportsArticleCount ( )

Definition at line 58 of file MainSlotRoleHandler.php.

Member Data Documentation

◆ $namespaceContentModels

string [] Revision\MainSlotRoleHandler::$namespaceContentModels
private

A mapping of namespaces to content models.

See also
$wgNamespaceContentModels

Definition at line 47 of file MainSlotRoleHandler.php.

Referenced by Revision\MainSlotRoleHandler\__construct().


The documentation for this class was generated from the following file: