MediaWiki
REL1_35
SlotRoleHandler.php
Go to the documentation of this file.
1
<?php
23
namespace
MediaWiki\Revision
;
24
25
use
MediaWiki\Linker\LinkTarget
;
26
36
class
SlotRoleHandler
{
37
41
private
$role
;
42
47
private
$layout
= [
48
'display'
=>
'section'
,
// use 'none' to suppress
49
'region'
=>
'center'
,
50
'placement'
=>
'append'
51
];
52
56
private
$contentModel
;
57
68
public
function
__construct
(
$role
,
$contentModel
,
$layout
= [] ) {
69
$this->role =
$role
;
70
$this->contentModel =
$contentModel
;
71
$this->layout = array_merge( $this->layout,
$layout
);
72
}
73
77
public
function
getRole
() {
78
return
$this->role
;
79
}
80
102
public
function
getOutputLayoutHints
() {
103
return
$this->layout
;
104
}
105
112
public
function
getNameMessageKey
() {
113
return
'slot-name-'
.
$this->role
;
114
}
115
129
public
function
getDefaultModel
(
LinkTarget
$page ) {
130
return
$this->contentModel
;
131
}
132
150
public
function
isAllowedModel
( $model,
LinkTarget
$page ) {
151
return
( $model === $this->contentModel );
152
}
153
167
public
function
supportsArticleCount
() {
168
return
false
;
169
}
170
171
}
MediaWiki\Revision\SlotRoleHandler
SlotRoleHandler instances are used to declare the existence and behavior of slot roles.
Definition
SlotRoleHandler.php:36
MediaWiki\Revision\SlotRoleHandler\$role
string $role
Definition
SlotRoleHandler.php:41
MediaWiki\Revision\SlotRoleHandler\$contentModel
string $contentModel
Definition
SlotRoleHandler.php:56
MediaWiki\Revision\SlotRoleHandler\getOutputLayoutHints
getOutputLayoutHints()
Layout hints for use while laying out the combined output of all slots, typically by RevisionRenderer...
Definition
SlotRoleHandler.php:102
MediaWiki\Revision\SlotRoleHandler\getRole
getRole()
Definition
SlotRoleHandler.php:77
MediaWiki\Revision\SlotRoleHandler\getNameMessageKey
getNameMessageKey()
The message key for the translation of the slot name.
Definition
SlotRoleHandler.php:112
MediaWiki\Revision\SlotRoleHandler\$layout
array $layout
Definition
SlotRoleHandler.php:47
MediaWiki\Revision\SlotRoleHandler\getDefaultModel
getDefaultModel(LinkTarget $page)
Determines the content model to use per default for this slot on the given page.
Definition
SlotRoleHandler.php:129
MediaWiki\Revision\SlotRoleHandler\__construct
__construct( $role, $contentModel, $layout=[])
Stable to call.
Definition
SlotRoleHandler.php:68
MediaWiki\Revision\SlotRoleHandler\supportsArticleCount
supportsArticleCount()
Whether this slot should be considered when determining whether a page should be counted as an "artic...
Definition
SlotRoleHandler.php:167
MediaWiki\Revision\SlotRoleHandler\isAllowedModel
isAllowedModel( $model, LinkTarget $page)
Determines whether the given model can be used on this slot on the given page.
Definition
SlotRoleHandler.php:150
MediaWiki\Linker\LinkTarget
Definition
LinkTarget.php:26
MediaWiki\Revision
Definition
ContributionsLookup.php:3
includes
Revision
SlotRoleHandler.php
Generated on Sat Apr 6 2024 00:07:46 for MediaWiki by
1.9.8