Manual:Hooks/EditFilterMerged
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.29.0</tvar> (after being deprecated in <tvar name=4>1.21.0</tvar>).</translate> <translate> Please see <tvar name=page>EditFilterMergedContent</tvar> for an alternative way to use this feature.</translate> |
EditFilterMerged | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> <translate> Removed in <tvar name=1><translate> version <tvar </tvar></translate> Post-section-merge edit filter | |
<translate> Define function:</translate> | public static function onEditFilterMerged( $editor, $text, &$error, $summary ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"EditFilterMerged": "MediaWiki\\Extension\\MyExtension\\Hooks::onEditFilterMerged"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> EditPage.php |
<translate> Interface:</translate> | EditFilterMergedHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:EditFilterMerged extensions</tvar>.</translate>
Details
- $editor: EditPage instance (object)
- $text: content of the revised article
- &$error: error message to return (broken until MW 1.16alpha)
- $summary: edit summary provided for edit
Notes
- As of MW 1.16alpha (r55681), you have the same two options for filtering edits as with the EditFilter hook:
- Return false to halt editing. You'll need to handle error messages, etc. yourself.
- Return true and modify $error (set to a value other than ''). This will cause the page to stay in edit mode and will cause the contents of $error to be displayed above the edit box. Note: $error should be wikitext.
- In earlier versions, your only option is to return false to halt editing (handling error messages yourself). Setting
$error
will not force the page to stay in edit mode.
$text
is the entire article, after incorporating the submitted text (the contents of the edit box) into the rest of the article; any sections of the article that the editor was not revising have been combined with the submitted text.