MediaWiki master
CodeContentHandler.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Content;
22
23use LogicException;
27
35abstract class CodeContentHandler extends TextContentHandler {
36
49 public function getPageLanguage( Title $title, ?Content $content = null ) {
50 return MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' );
51 }
52
65 public function getPageViewLanguage( Title $title, ?Content $content = null ) {
66 return MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' );
67 }
68
70 protected function getContentClass() {
71 throw new LogicException( 'Subclass must override' );
72 }
73
74}
76class_alias( CodeContentHandler::class, 'CodeContentHandler' );
Content handler for pages with source code as content (e.g.
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
Content objects represent page content, e.g.
Definition Content.php:42