Manual:Hooks/EditFilterMergedContent

From Linux Web Expert

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
EditFilterMergedContent
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
Post-section-merge edit filter.
<translate> Define function:</translate>
public static function onEditFilterMergedContent( $context, $content, $status, $summary, $user, $minoredit ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"EditFilterMergedContent": "MediaWiki\\Extension\\MyExtension\\Hooks::onEditFilterMergedContent"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> EditPage.php
<translate> Interface:</translate> EditFilterMergedContentHook.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:EditFilterMergedContent extensions</tvar>.</translate>


This may be triggered by the EditPage or any other facility that modifies page content. Use the $status object to indicate whether the edit should be allowed, and to provide a reason for disallowing it. Return false to abort the edit, and true to continue. Returning true if $status->isOK() returns false means "don't save but continue user interaction", e.g. show the edit form.

Details

  • $context: object implementing the IContextSource interface.
  • $content: content of the edit box, as a Content object.
  • $status: Status object to represent errors, etc.
  • $summary: Edit summary for page
  • $user: the User object representing the user whois performing the edit.
  • $minoredit: whether the edit was marked as minor by the user.