Manual:Hooks/APIEditBeforeSave/fr

From mediawiki.org
This page is a translated version of the page Manual:Hooks/APIEditBeforeSave and the translation is 20% complete.
APIEditBeforeSave
Disponible depuis version 1.13.0
Supprimé dans version 1.34.0 (Gerrit change 519797)
Called right before saving an edit submitted through api.php?action=edit
Fonction à définir :
public static function onAPIEditBeforeSave( $editPage, $text, &$resultArr ) { ... }
Attacher l'accroche : Dans extension.json :
{
	"Hooks": {
		"APIEditBeforeSave": "MediaWiki\\Extension\\MyExtension\\Hooks::onAPIEditBeforeSave"
	}
}
Appelé de : Fichier(s) : api/ApiEditPage.php
Interface : APIEditBeforeSaveHook.php

Pour plus d'information sur l'ajout des accroches (hooks), voir Accroches .
Pour des exemples d'extensions utilisant cette accroche, voir Category:APIEditBeforeSave extensions/fr .

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.