MediaWiki  1.34.0
ScribuntoContentHandler.php
Go to the documentation of this file.
1 <?php
13 
18  public function __construct(
19  $modelId = CONTENT_MODEL_SCRIBUNTO, $formats = [ CONTENT_FORMAT_TEXT ]
20  ) {
21  parent::__construct( $modelId, $formats );
22  }
23 
24  protected function getContentClass() {
25  return 'ScribuntoContent';
26  }
27 
32  public function isSupportedFormat( $format ) {
33  // An error in an earlier version of Scribunto means we might see this.
34  if ( $format === 'CONTENT_FORMAT_TEXT' ) {
35  $format = CONTENT_FORMAT_TEXT;
36  }
37  return parent::isSupportedFormat( $format );
38  }
39 
45  public function canBeUsedOn( Title $title ) {
46  if ( $title->getNamespace() !== NS_MODULE ) {
47  return false;
48  }
49 
50  return parent::canBeUsedOn( $title );
51  }
52 }
ScribuntoContentHandler
Definition: ScribuntoContentHandler.php:12
ScribuntoContentHandler\canBeUsedOn
canBeUsedOn(Title $title)
Only allow this content handler to be used in the Module namespace.
Definition: ScribuntoContentHandler.php:45
CodeContentHandler
Content handler for code content such as CSS, JavaScript, JSON, etc.
Definition: CodeContentHandler.php:29
ScribuntoContentHandler\getContentClass
getContentClass()
Definition: ScribuntoContentHandler.php:24
NS_MODULE
const NS_MODULE
Definition: Scribunto.constants.php:5
CONTENT_FORMAT_TEXT
const CONTENT_FORMAT_TEXT
Definition: Defines.php:236
$title
$title
Definition: testCompression.php:34
Title
Represents a title within MediaWiki.
Definition: Title.php:42
ScribuntoContentHandler\isSupportedFormat
isSupportedFormat( $format)
Definition: ScribuntoContentHandler.php:32
ScribuntoContentHandler\__construct
__construct( $modelId=CONTENT_MODEL_SCRIBUNTO, $formats=[CONTENT_FORMAT_TEXT])
Definition: ScribuntoContentHandler.php:18