Manual:Hooks/ContentModelCanBeUsedOn
ContentModelCanBeUsedOn | |
---|---|
Available from version 1.23.0 (Gerrit change 100563) | |
Define function: | public static function onContentModelCanBeUsedOn( $modelId, Title $title, &$ok ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"ContentModelCanBeUsedOn": "MediaWiki\\Extension\\MyExtension\\Hooks::onContentModelCanBeUsedOn"
}
}
|
Called from: | File(s): content/ContentHandler.php Function(s): canBeUsedOn |
Interface: | ContentModelCanBeUsedOnHook.php |
For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ContentModelCanBeUsedOn extensions.
Details
editThis hook is called by ContentHandler::canBeUsedOn() to determine whether a certain content model can be used on a certain title or not. This is checked, for example, on import or when moving pages .
- $modelId: The content model ID, e. g.
'wikitext'
or'json'
. - $title: The title where the content model may or may not be used.
- &$ok: Whether the content model can be used on the title or not. Initially
true
; when you set this tofalse
, you probably also want toreturn false;
to skip the remaining hooks.