MediaWiki
1.33.0
|
SlotRoleHandler instances are used to declare the existence and behavior of slot roles. More...
Public Member Functions | |
__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 | $contentModel |
array | $layout |
string | $role |
SlotRoleHandler instances are used to declare the existence and behavior of slot roles.
Most importantly, they control which content model can be used for the slot, and how it is represented in the rendered verswion of page content.
Definition at line 34 of file SlotRoleHandler.php.
Revision\SlotRoleHandler::__construct | ( | $role, | |
$contentModel, | |||
$layout = [] |
|||
) |
string | $role | The name of the slot role defined by this SlotRoleHandler. See SlotRoleRegistry::defineRole for more information. |
string | $contentModel | The default content model for this slot. As per the default implementation of isAllowedModel(), also the only content model allowed for the slot. Subclasses may however handle default and allowed models differently. |
array | $layout | Layout hints, for use by RevisionRenderer. See getOutputLayoutHints. |
Definition at line 64 of file SlotRoleHandler.php.
References Revision\SlotRoleHandler\$contentModel, Revision\SlotRoleHandler\$role, and layout.
Revision\SlotRoleHandler::getDefaultModel | ( | LinkTarget | $page | ) |
Determines the content model to use per default for this slot on the given page.
The default implementation always returns the content model provided to the constructor. Subclasses may base the choice on default model on the page title or namespace. The choice should not depend on external state, such as the page content.
LinkTarget | $page |
Reimplemented in Revision\MainSlotRoleHandler.
Definition at line 121 of file SlotRoleHandler.php.
References Revision\SlotRoleHandler\$contentModel.
Revision\SlotRoleHandler::getNameMessageKey | ( | ) |
The message key for the translation of the slot name.
Definition at line 106 of file SlotRoleHandler.php.
References Revision\SlotRoleHandler\$role.
Revision\SlotRoleHandler::getOutputLayoutHints | ( | ) |
Layout hints for use while laying out the combined output of all slots, typically by RevisionRenderer.
The layout hints are given as an associative array. Well-known keys to use:
Reimplemented in Revision\FallbackSlotRoleHandler.
Definition at line 97 of file SlotRoleHandler.php.
References Revision\SlotRoleHandler\$layout.
Revision\SlotRoleHandler::getRole | ( | ) |
Definition at line 73 of file SlotRoleHandler.php.
References Revision\SlotRoleHandler\$role.
Revision\SlotRoleHandler::isAllowedModel | ( | $model, | |
LinkTarget | $page | ||
) |
Determines whether the given model can be used on this slot on the given page.
The default implementation checks whether $model is the content model provided to the constructor. Subclasses may allow other models and may base the decision on the page title or namespace. The choice should not depend on external state, such as the page content.
string | $model | |
LinkTarget | $page |
Reimplemented in Revision\MainSlotRoleHandler, and Revision\FallbackSlotRoleHandler.
Definition at line 140 of file SlotRoleHandler.php.
Revision\SlotRoleHandler::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.
Reimplemented in Revision\MainSlotRoleHandler.
Definition at line 155 of file SlotRoleHandler.php.
|
private |
Definition at line 54 of file SlotRoleHandler.php.
Referenced by Revision\SlotRoleHandler\__construct(), and Revision\SlotRoleHandler\getDefaultModel().
|
private |
Definition at line 45 of file SlotRoleHandler.php.
Referenced by Revision\SlotRoleHandler\getOutputLayoutHints().
|
private |
Definition at line 39 of file SlotRoleHandler.php.
Referenced by Revision\FallbackSlotRoleHandler\__construct(), Revision\SlotRoleHandler\__construct(), Revision\SlotRoleHandler\getNameMessageKey(), and Revision\SlotRoleHandler\getRole().