< Manual:Hooks
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": "MyExtensionHooks::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
This 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
'wikitext'
or'json'
.
ID, e. g. - $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.
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.