<translate> Content Models and Handlers</translate>
<translate> MediaWiki allows for page content types other than wikitext.</translate> <translate> It offers built-in support for JavaScript, CSS, JSON and plain text.</translate> <translate> Extensions can use MediaWiki's ContentHandler mechanism to add new content models for accepting different formats and controlling how they are rendered, stored and edited.</translate>
Plugins for page content model handling.Each entry in the array maps a model ID constant to a PHP class name.
<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.34</tvar> is unsupported version</translate>">
1.34
<translate> MediaWiki version:</translate>
When undeploying an extension that provides handling for a content model, that content model becomes unsupported, leading to MWUnknownContentModelExceptions to be raised. To avoid this, the content model in question can be defined to use the UnknownContentHandler:
The content of pages that use this content model remain readable and editable, but lose any special capabilities and markup support.
Default value
<td class="mw-version-versionbox" title="<translate nowrap> The latest stable version is <tvar name=1>1.41</tvar></translate>">
<translate> ≥</translate> 1.41
<translate> MediaWiki version:</translate>
$wgContentHandlers=[// the usual caseCONTENT_MODEL_WIKITEXT=>['class'=>WikitextContentHandler::class,'services'=>['TitleFactory','ParserFactory','GlobalIdGenerator','LanguageNameUtils','LinkRenderer','MagicWordFactory','ParsoidParserFactory',],],// dumb version, no syntax highlightingCONTENT_MODEL_JAVASCRIPT=>JavaScriptContentHandler::class,// simple implementation, for use by extensions, etc.CONTENT_MODEL_JSON=>JsonContentHandler::class,// dumb version, no syntax highlightingCONTENT_MODEL_CSS=>CssContentHandler::class,// plain text, for use by extensions, etc.CONTENT_MODEL_TEXT=>TextContentHandler::class,// fallback for unknown models, from imports or extensions that were removedCONTENT_MODEL_UNKNOWN=>FallbackContentHandler::class,];
<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.40</tvar> is legacy version</translate>">
1.40
<translate> MediaWiki version:</translate>
$wgContentHandlers=[// the usual caseCONTENT_MODEL_WIKITEXT=>['class'=>WikitextContentHandler::class,'services'=>['TitleFactory','ParserFactory','GlobalIdGenerator','LanguageNameUtils','MagicWordFactory',],],// dumb version, no syntax highlightingCONTENT_MODEL_JAVASCRIPT=>JavaScriptContentHandler::class,// simple implementation, for use by extensions, etc.CONTENT_MODEL_JSON=>JsonContentHandler::class,// dumb version, no syntax highlightingCONTENT_MODEL_CSS=>CssContentHandler::class,// plain text, for use by extensions, etc.CONTENT_MODEL_TEXT=>TextContentHandler::class,// fallback for unknown models, from imports or extensions that were removedCONTENT_MODEL_UNKNOWN=>FallbackContentHandler::class,];
<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.39</tvar> is legacy version</translate>">
1.36 – 1.39
<translate> MediaWiki versions:</translate>
$wgContentHandlers=[// the usual caseCONTENT_MODEL_WIKITEXT=>WikitextContentHandler::class,// dumb version, no syntax highlightingCONTENT_MODEL_JAVASCRIPT=>JavaScriptContentHandler::class,// simple implementation, for use by extensions, etc.CONTENT_MODEL_JSON=>JsonContentHandler::class,// dumb version, no syntax highlightingCONTENT_MODEL_CSS=>CssContentHandler::class,// plain text, for use by extensions, etc.CONTENT_MODEL_TEXT=>TextContentHandler::class,// fallback for unknown models, from imports or extensions that were removedCONTENT_MODEL_UNKNOWN=>FallbackContentHandler::class,];
<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.35</tvar> is unsupported version</translate>">
1.31 – 1.35
<translate> MediaWiki versions:</translate>
$wgContentHandlers=[// the usual caseCONTENT_MODEL_WIKITEXT=>WikitextContentHandler::class,// dumb version, no syntax highlightingCONTENT_MODEL_JAVASCRIPT=>JavaScriptContentHandler::class,// simple implementation, for use by extensions, etc.CONTENT_MODEL_JSON=>JsonContentHandler::class,// dumb version, no syntax highlightingCONTENT_MODEL_CSS=>CssContentHandler::class,// plain text, for use by extensions, etc.CONTENT_MODEL_TEXT=>TextContentHandler::class,];
<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.30</tvar> is unsupported version</translate>">
1.24 – 1.30
<translate> MediaWiki versions:</translate>
$wgContentHandlers=[// the usual caseCONTENT_MODEL_WIKITEXT=>'WikitextContentHandler',// dumb version, no syntax highlightingCONTENT_MODEL_JAVASCRIPT=>'JavaScriptContentHandler',// simple implementation, for use by extensions, etc.CONTENT_MODEL_JSON=>'JsonContentHandler',// dumb version, no syntax highlightingCONTENT_MODEL_CSS=>'CssContentHandler',// plain text, for use by extensions, etc.CONTENT_MODEL_TEXT=>'TextContentHandler',];
<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.23</tvar> is unsupported version</translate>">
1.21 – 1.23
<translate> MediaWiki versions:</translate>
$wgContentHandlers=array(// the usual caseCONTENT_MODEL_WIKITEXT=>'WikitextContentHandler',// dumb version, no syntax highlightingCONTENT_MODEL_JAVASCRIPT=>'JavaScriptContentHandler',// dumb version, no syntax highlightingCONTENT_MODEL_CSS=>'CssContentHandler',// plain text, for use by extensions etcCONTENT_MODEL_TEXT=>'TextContentHandler',);