Manual:Hooks/APIEditBeforeSave/fr
From Linux Web Expert
File:OOjs UI icon alert-destructive.svg | <translate> This feature was removed from MediaWiki core in version <tvar name=ver>1.34.0</tvar> (after being deprecated in <tvar name=4>1.28.0</tvar>).</translate> <translate> Please see <tvar name=page>EditFilterMergedContent</tvar> for an alternative way to use this feature.</translate> |
APIEditBeforeSave | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> <translate> Removed in <tvar name=1><translate> version <tvar (Gerrit change 519797)</tvar></translate> Called right before saving an edit submitted through api.php?action=edit | |
<translate> Define function:</translate> | public static function onAPIEditBeforeSave( $editPage, $text, &$resultArr ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"APIEditBeforeSave": "MediaWiki\\Extension\\MyExtension\\Hooks::onAPIEditBeforeSave"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> api/ApiEditPage.php |
<translate> Interface:</translate> | APIEditBeforeSaveHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Accroches </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:APIEditBeforeSave extensions/fr</tvar>.</translate>
Détails
- $editPage: the EditPage object
- $text: the new text of the article (has yet to be saved)
- $resultArr: data in this array will be added to the API result
Notes
Return true to continue processing, return false to abort processing and reject the edit.
If $resultArr was filled, the API will return an <edit result="Failure">
element with the contents of $resultArr added in.
If $resultArr wasn't filled, the API will return an error message.