Manual:Hooks/APIEditBeforeSave/fr

From Linux Web Expert

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.