| 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 "ChangeTagCanDelete" to register handlers implementing this interface. |
| 11 | * |
| 12 | * @stable to implement |
| 13 | * @ingroup Hooks |
| 14 | */ |
| 15 | interface ChangeTagCanDeleteHook { |
| 16 | /** |
| 17 | * Use this hook to tell whether a change tag should be able to be |
| 18 | * deleted from the UI (Special:Tags) or via the API. The default is that tags |
| 19 | * defined using the ListDefinedTags hook are not allowed to be deleted unless |
| 20 | * specifically allowed. Ensure you consume the ChangeTagAfterDelete hook to carry |
| 21 | * out custom deletion actions. |
| 22 | * |
| 23 | * @since 1.35 |
| 24 | * |
| 25 | * @param string $tag Name of the tag |
| 26 | * @param User|null $user User initiating the action |
| 27 | * @param Status &$status To allow deletion of the tag, set `$status = Status::newGood()`, |
| 28 | * and then return false from the hook function. |
| 29 | * @return bool|void True or no return value to continue or false to allow deletion of the tag |
| 30 | */ |
| 31 | public function onChangeTagCanDelete( $tag, $user, &$status ); |
| 32 | } |