MediaWiki REL1_37
|
SlotRoleHandler instances are used to declare the existence and behavior of slot roles. More...
Public Member Functions | |
__construct ( $role, $contentModel, $layout=[], bool $derived=false) | |
getDefaultModel ( $page) | |
Determines the content model to use per default for this slot on the given page. | |
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 () | |
isAllowedModel ( $model, PageIdentity $page) | |
Determines whether the given model can be used on this slot on the given page. | |
isDerived () | |
supportsArticleCount () | |
Whether this slot should be considered when determining whether a page should be counted as an "article" in the site statistics. | |
Private Attributes | |
string | $contentModel |
bool | $derived |
string[] | $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 version of page content.
Definition at line 37 of file SlotRoleHandler.php.
MediaWiki\Revision\SlotRoleHandler::__construct | ( | $role, | |
$contentModel, | |||
$layout = [] , |
|||
bool | $derived = false |
||
) |
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. |
string[] | $layout | Layout hints, for use by RevisionRenderer. See getOutputLayoutHints. |
bool | $derived | Is this handler for a derived slot? Derived slots allow information that is derived from the content of a page to be stored even if it is generated asynchronously or updated later. Their size is not included in the revision size, their hash does not contribute to the revision hash, and updates are not included in revision history. |
Definition at line 80 of file SlotRoleHandler.php.
References MediaWiki\Revision\SlotRoleHandler\$contentModel, MediaWiki\Revision\SlotRoleHandler\$derived, MediaWiki\Revision\SlotRoleHandler\$layout, and MediaWiki\Revision\SlotRoleHandler\$role.
MediaWiki\Revision\SlotRoleHandler::getDefaultModel | ( | $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 | PageIdentity | $page |
Reimplemented in MediaWiki\Revision\MainSlotRoleHandler.
Definition at line 150 of file SlotRoleHandler.php.
MediaWiki\Revision\SlotRoleHandler::getNameMessageKey | ( | ) |
The message key for the translation of the slot name.
Definition at line 133 of file SlotRoleHandler.php.
MediaWiki\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 MediaWiki\Revision\FallbackSlotRoleHandler.
Definition at line 115 of file SlotRoleHandler.php.
References MediaWiki\Revision\SlotRoleHandler\$layout.
MediaWiki\Revision\SlotRoleHandler::getRole | ( | ) |
Definition at line 90 of file SlotRoleHandler.php.
References MediaWiki\Revision\SlotRoleHandler\$role.
MediaWiki\Revision\SlotRoleHandler::isAllowedModel | ( | $model, | |
PageIdentity | $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 | |
PageIdentity | $page |
Reimplemented in MediaWiki\Revision\FallbackSlotRoleHandler, and MediaWiki\Revision\MainSlotRoleHandler.
Definition at line 171 of file SlotRoleHandler.php.
MediaWiki\Revision\SlotRoleHandler::isDerived | ( | ) |
Definition at line 123 of file SlotRoleHandler.php.
MediaWiki\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 MediaWiki\Revision\MainSlotRoleHandler.
Definition at line 188 of file SlotRoleHandler.php.
|
private |
Definition at line 62 of file SlotRoleHandler.php.
Referenced by MediaWiki\Revision\SlotRoleHandler\__construct().
|
private |
Definition at line 57 of file SlotRoleHandler.php.
Referenced by MediaWiki\Revision\SlotRoleHandler\__construct().
|
private |
Definition at line 48 of file SlotRoleHandler.php.
Referenced by MediaWiki\Revision\SlotRoleHandler\__construct(), and MediaWiki\Revision\SlotRoleHandler\getOutputLayoutHints().
|
private |
Definition at line 42 of file SlotRoleHandler.php.
Referenced by MediaWiki\Revision\FallbackSlotRoleHandler\__construct(), MediaWiki\Revision\SlotRoleHandler\__construct(), and MediaWiki\Revision\SlotRoleHandler\getRole().