MediaWiki REL1_34
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}
const NS_MODULE
Content handler for code content such as CSS, JavaScript, JSON, etc.
__construct( $modelId=CONTENT_MODEL_SCRIBUNTO, $formats=[CONTENT_FORMAT_TEXT])
canBeUsedOn(Title $title)
Only allow this content handler to be used in the Module namespace.
Represents a title within MediaWiki.
Definition Title.php:42
const CONTENT_FORMAT_TEXT
Definition Defines.php:245