MediaWiki REL1_39
MediaWiki\Revision\MainSlotRoleHandler Class Reference

A SlotRoleHandler for the main slot. More...

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

Public Member Functions

 __construct (array $namespaceContentModels, IContentHandlerFactory $contentHandlerFactory, HookContainer $hookContainer, TitleFactory $titleFactory)
 
 getDefaultModel ( $page)
 
 isAllowedModel ( $model, PageIdentity $page)
 
 supportsArticleCount ()
 Whether this slot should be considered when determining whether a page should be counted as an "article" in the site statistics.
 
- Public Member Functions inherited from MediaWiki\Revision\SlotRoleHandler
 __construct ( $role, $contentModel, $layout=[], bool $derived=false)
 
 getNameMessageKey ()
 The message key for the translation of the slot name.
 
 getOutputLayoutHints ()
 Layout hints for use while laying out the combined output of all slots, typically by RevisionRenderer.
 
 getRole ()
 
 isDerived ()
 

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 44 of file MainSlotRoleHandler.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Revision\MainSlotRoleHandler::__construct ( array $namespaceContentModels,
IContentHandlerFactory $contentHandlerFactory,
HookContainer $hookContainer,
TitleFactory $titleFactory )
Parameters
string[]$namespaceContentModelsA mapping of namespaces to content models, typically from $wgNamespaceContentModels.
IContentHandlerFactory$contentHandlerFactory
HookContainer$hookContainer
TitleFactory$titleFactory

Definition at line 68 of file MainSlotRoleHandler.php.

References CONTENT_MODEL_WIKITEXT.

Member Function Documentation

◆ getDefaultModel()

MediaWiki\Revision\MainSlotRoleHandler::getDefaultModel ( $page)
Parameters
LinkTarget | PageIdentity$page
Returns
string

Reimplemented from MediaWiki\Revision\SlotRoleHandler.

Definition at line 105 of file MainSlotRoleHandler.php.

References $ext, $title, CONTENT_MODEL_CSS, CONTENT_MODEL_JAVASCRIPT, CONTENT_MODEL_JSON, CONTENT_MODEL_TEXT, CONTENT_MODEL_WIKITEXT, NS_MEDIAWIKI, and NS_USER.

◆ isAllowedModel()

MediaWiki\Revision\MainSlotRoleHandler::isAllowedModel ( $model,
PageIdentity $page )
Parameters
string$model
PageIdentity$page
Returns
bool
Exceptions
MWUnknownContentModelException

Reimplemented from MediaWiki\Revision\SlotRoleHandler.

Definition at line 92 of file MainSlotRoleHandler.php.

References $title.

◆ supportsArticleCount()

MediaWiki\Revision\MainSlotRoleHandler::supportsArticleCount ( )

Whether this slot should be considered when determining whether a page should be counted as an "article" in the site statistics.

For a page to be considered countable, one of the page's slots must return true from this method, and Content::isCountable() must return true for the content of that slot.

The default implementation always returns false.

Stability: stable
to override
Returns
bool

Reimplemented from MediaWiki\Revision\SlotRoleHandler.

Definition at line 81 of file MainSlotRoleHandler.php.


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