Manual:Hooks/APIEditBeforeSave
Jump to navigation
Jump to search
![]() | This deprecated feature should no longer be used, but is still available for reasons of backwards compatibility. This feature was deprecated in version 1.28. Please see EditFilterMergedContent for an alternative way to use this feature. |
![]() | This deprecated feature should no longer be used, but is still available for reasons of backwards compatibility. This feature was deprecated in version 1.28.0. |
APIEditBeforeSave | |
---|---|
Available from version 1.13.0 Called right before saving an edit submitted through api.php?action=edit |
|
Define function: |
public static function onAPIEditBeforeSave( $editPage, $text, &$resultArr ) { ... }
|
Attach hook: |
In extension.json: {
"Hooks": {
"APIEditBeforeSave": "MyExtensionHooks::onAPIEditBeforeSave"
}
}
For MediaWiki ≤1.25: $wgHooks['APIEditBeforeSave'][] = 'MyExtensionHooks::onAPIEditBeforeSave';
|
Called from: | File(s): ApiEditPage.php |
For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:APIEditBeforeSave extensions.
Details[edit]
- $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[edit]
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.