MediaWiki REL1_37
FallbackContent.php
Go to the documentation of this file.
1<?php
39
41 private $data;
42
47 public function __construct( $data, $model_id ) {
48 parent::__construct( $model_id );
49
50 $this->data = $data;
51 }
52
56 public function copy() {
57 // UnknownContent is immutable, so no need to copy.
58 return $this;
59 }
60
68 public function getTextForSummary( $maxlength = 250 ) {
69 return '';
70 }
71
77 public function getSize() {
78 return strlen( $this->data );
79 }
80
89 public function isCountable( $hasLinks = null ) {
90 return false;
91 }
92
96 public function getNativeData() {
97 return $this->getData();
98 }
99
103 public function getData() {
104 return $this->data;
105 }
106
112 public function serialize( $format = null ) {
113 return $this->getData();
114 }
115
121 public function getTextForSearchIndex() {
122 return '';
123 }
124
128 public function getWikitextForTransclusion() {
129 return false;
130 }
131
140 protected function fillParserOutput( Title $title, $revId,
141 ParserOptions $options, $generateHtml, ParserOutput &$output
142 ) {
143 $msg = wfMessage( 'unsupported-content-model', [ $this->getModel() ] );
144 $html = Html::rawElement( 'div', [ 'class' => 'error' ], $msg->inContentLanguage()->parse() );
145 $output->setText( $html );
146 }
147
153 public function convert( $toModel, $lossy = '' ) {
154 return false;
155 }
156
157 protected function equalsInternal( Content $that ) {
158 if ( !$that instanceof FallbackContent ) {
159 return false;
160 }
161
162 return $this->getData() == $that->getData();
163 }
164
165}
166
167class_alias( FallbackContent::class, 'UnknownContent' );
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Base implementation for content objects.
string $model_id
Name of the content model this Content object represents.
Content object implementation representing unknown content.
__construct( $data, $model_id)
convert( $toModel, $lossy='')
getTextForSearchIndex()
Returns an empty string.
getTextForSummary( $maxlength=250)
Returns an empty string.
isCountable( $hasLinks=null)
Returns false.
getSize()
Returns the data size in bytes.
equalsInternal(Content $that)
Checks whether $that is logically equal to this Content object.
serialize( $format=null)
fillParserOutput(Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
Fills the ParserOutput with an error message.
Set options of the Parser.
Represents a title within MediaWiki.
Definition Title.php:48
Base interface for content objects.
Definition Content.php:35