Jump to content

Manual:Hooks/ChangeTagsAllowedAdd

From mediawiki.org
ChangeTagsAllowedAdd
Available from version 1.30.0 (Gerrit change 337565)
Called when checking if a user can add tags to a change.
Define function:
public static function onChangeTagsAllowedAdd( array &$allowedTags, array $tags, User $user = null ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ChangeTagsAllowedAdd": "MediaWiki\\Extension\\MyExtension\\Hooks::onChangeTagsAllowedAdd"
	}
}
Called from: File(s): changetags/ChangeTags.php
Function(s): canAddTagsAccompanyingChange
Interface: ChangeTagsAllowedAddHook.php

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


Details

[edit]
  • &$allowedTags: Array of all the tags the user is allowed to add. Any tags the user wants to add (in $tags, the next parameter) that are not in this array will cause it to fail. You may add or remove tags to this array as required.
  • $tags: Array of tags user intends to add.
  • $user: User who is adding the tags, or null if checking for a generic non-blocked user with the relevant rights.