Manual:Hooks/ChangeTagCanDelete
Appearance
ChangeTagCanDelete | |
---|---|
Available from version 1.25.0 Tell whether a change tag should be able to be deleted by users. | |
Define function: | public static function onChangeTagCanDelete( $tag, $user, Status &$status ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"ChangeTagCanDelete": "MediaWiki\\Extension\\MyExtension\\Hooks::onChangeTagCanDelete"
}
}
|
Called from: | File(s): ChangeTags.php |
Interface: | ChangeTagCanDeleteHook.php |
For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ChangeTagCanDelete extensions.
Details
[edit]- $tag: Name of the tag.
- $user: User object representing the user who initiated the action. May be null.
- &$status: Status object, in a "fatal" (not OK) state initially. See below.
Notes
[edit]This hook allows extensions to determine whether a change tag should be able to be deleted from the UI (Special:Tags) or via the API.
The default is that tags defined using the ListDefinedTags hook are not allowed to be deleted unless specifically allowed by this hook. If you wish to allow deletion of the tag, set $status = Status::newGood()
to allow deletion, and then return false
from the hook function.
Ensure you also implement the ChangeTagAfterDelete hook to carry out custom deletion actions.