Manual:Hooks/GetAllBlockActions

From Linux Web Expert

GetAllBlockActions
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 681005)</tvar></translate>
Add an action that can be blocked via a partial block.
<translate> Define function:</translate>
public static function onGetAllBlockActions( array &$actions ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"GetAllBlockActions": "MediaWiki\\Extension\\MyExtension\\Hooks::onGetAllBlockActions"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> block/BlockActionInfo.php
<translate> Function(s):</translate> getAllBlockActions
<translate> Interface:</translate> GetAllBlockActionsHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:GetAllBlockActions extensions</tvar>.</translate>


The action should be added to the $action array. The key should be the name of the action as it appears in the code, and the value should be a unique integer ID.

IDs for extension actions must be 100 or greater and must not conflict with other extensions' IDs. IDs must be documented here in order to ensure no conflicts:

ID Extension Action name
100 Thanks thanks
200 ImportDump request-import-dump

In the future ID conflicts may instead be handled by MediaWiki (see <translate> task <tvar name=1>T280808</tvar></translate>).

Details

  • &$actions: array of action names to unique IDs