Manual:Hooks/GetContentModels

Category:MediaWiki hooks#GetContentModels Category:Hooks added in MediaWiki 1.29.0#GetContentModels
GetContentModels
Available from version 1.29.0
Allows to add custom content handlers to the list of content models registered with the system.
Define function:
public static function onGetContentModels( &$models ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"GetContentModels": "MediaWiki\\Extension\\MyExtension\\Hooks::onGetContentModels"
	}
}
Called from: File(s): ContentHandler.phpCategory:MediaWiki hooks included in ContentHandler.php#GetContentModels
Interface: GetContentModelsHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:GetContentModels extensions.

Details

  • &$models: array of content model names. The extension should add its models to this array.

It is recommended that the extensions processing content models via ContentHandlerForModelID hook would register these models using this hook, otherwise the core does not know these models exist.

For more information on content models see ContentHandler.

Category:Hooks added in MediaWiki 1.29.0 Category:MediaWiki hooks Category:MediaWiki hooks included in ContentHandler.php