MediaWiki master
CodeContentHandler.php
Go to the documentation of this file.
1<?php
24namespace MediaWiki\Content;
25
26use LogicException;
30
38abstract class CodeContentHandler extends TextContentHandler {
39
52 public function getPageLanguage( Title $title, ?Content $content = null ) {
53 return MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' );
54 }
55
68 public function getPageViewLanguage( Title $title, ?Content $content = null ) {
69 return MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' );
70 }
71
73 protected function getContentClass() {
74 throw new LogicException( 'Subclass must override' );
75 }
76
77}
79class_alias( CodeContentHandler::class, 'CodeContentHandler' );
Content handler for code content such as CSS, JavaScript, JSON, etc.
getPageLanguage(Title $title, ?Content $content=null)
Returns the English language, because code is English, and should be handled as such.
getPageViewLanguage(Title $title, ?Content $content=null)
Returns the English language, because code is English, and should be handled as such.
getContentClass()
Returns the name of the associated Content class, to be used when creating new objects....
Base content handler implementation for flat text contents.
Base class for language-specific code.
Definition Language.php:81
Service locator for MediaWiki core services.
static getInstance()
Returns the global default instance of the top level service locator.
Represents a title within MediaWiki.
Definition Title.php:78
Base interface for representing page content.
Definition Content.php:39