| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\ChangeTags\Hook; |
| 4 | |
| 5 | use MediaWiki\Status\Status; |
| 6 | use MediaWiki\User\User; |
| 7 | |
| 8 | /** |
| 9 | * This is a hook handler interface, see docs/Hooks.md. |
| 10 | * Use the hook name "ChangeTagCanCreate" to register handlers implementing this interface. |
| 11 | * |
| 12 | * @stable to implement |
| 13 | * @ingroup Hooks |
| 14 | */ |
| 15 | interface ChangeTagCanCreateHook { |
| 16 | /** |
| 17 | * Use this hook to tell whether a change tag should be able to be created |
| 18 | * from the UI (Special:Tags) or via the API. You could use this hook if you want |
| 19 | * to reserve a specific "namespace" of tags, or something similar. |
| 20 | * |
| 21 | * @since 1.35 |
| 22 | * |
| 23 | * @param string $tag Name of the tag |
| 24 | * @param User|null $user User initiating the action |
| 25 | * @param Status &$status Add your errors using `$status->fatal()` or warnings |
| 26 | * using `$status->warning()`. Errors and warnings will be relayed to the user. |
| 27 | * If you set an error, the user will be unable to create the tag. |
| 28 | * @return bool|void True or no return value to continue or false to abort |
| 29 | */ |
| 30 | public function onChangeTagCanCreate( $tag, $user, &$status ); |
| 31 | } |