MediaWiki REL1_35
SlotRoleHandler.php
Go to the documentation of this file.
1<?php
23namespace MediaWiki\Revision;
24
26
37
41 private $role;
42
47 private $layout = [
48 'display' => 'section', // use 'none' to suppress
49 'region' => 'center',
50 'placement' => 'append'
51 ];
52
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}
SlotRoleHandler instances are used to declare the existence and behavior of slot roles.
getOutputLayoutHints()
Layout hints for use while laying out the combined output of all slots, typically by RevisionRenderer...
getNameMessageKey()
The message key for the translation of the slot name.
getDefaultModel(LinkTarget $page)
Determines the content model to use per default for this slot on the given page.
__construct( $role, $contentModel, $layout=[])
Stable to call.
supportsArticleCount()
Whether this slot should be considered when determining whether a page should be counted as an "artic...
isAllowedModel( $model, LinkTarget $page)
Determines whether the given model can be used on this slot on the given page.