| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Hook; |
| 4 | |
| 5 | use MediaWiki\Content\Content; |
| 6 | use MediaWiki\Context\IContextSource; |
| 7 | use MediaWiki\Status\Status; |
| 8 | use MediaWiki\User\User; |
| 9 | |
| 10 | /** |
| 11 | * This is a hook handler interface, see docs/Hooks.md. |
| 12 | * Use the hook name "EditFilterMergedContent" to register handlers implementing this interface. |
| 13 | * |
| 14 | * @stable to implement |
| 15 | * @ingroup Hooks |
| 16 | */ |
| 17 | interface EditFilterMergedContentHook { |
| 18 | /** |
| 19 | * Use this hook for a post-section-merge edit filter. This may be triggered by |
| 20 | * the EditPage or any other facility that modifies page content. Use the return value |
| 21 | * to indicate whether the edit should be allowed, and use the $status object to provide |
| 22 | * a reason for disallowing it. $status->apiHookResult can be set to an array to be returned |
| 23 | * by api.php action=edit. This is used to deliver captchas. |
| 24 | * |
| 25 | * @since 1.35 |
| 26 | * |
| 27 | * @param IContextSource $context |
| 28 | * @param Content $content Content of the edit box |
| 29 | * @param Status $status Status object to represent errors, etc. |
| 30 | * @param string $summary Edit summary for page |
| 31 | * @param User $user User whois performing the edit |
| 32 | * @param bool $minoredit Whether the edit was marked as minor by the user. |
| 33 | * @return bool|void False or no return value with not $status->isOK() to abort the edit |
| 34 | * and show the edit form, true to continue. But because multiple triggers of this hook |
| 35 | * may have different behavior in different version (T273354), you'd better return false |
| 36 | * and set $status->value to EditPage::AS_HOOK_ERROR_EXPECTED or any other customized value. |
| 37 | */ |
| 38 | public function onEditFilterMergedContent( IContextSource $context, Content $content, Status $status, |
| 39 | $summary, User $user, $minoredit |
| 40 | ); |
| 41 | } |