Manual:Hooks/PlaceNewSection

PlaceNewSection
Available from version 1.19.0 (r101096, CodeReview archive)
Override placement of new sections.
Define function:
public static function onPlaceNewSection( $wikipage, $oldtext, $subject, &$text ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"PlaceNewSection": "MediaWiki\\Extension\\MyExtension\\Hooks::onPlaceNewSection"
	}
}
Called from: File(s): page/WikiPage.php
Interface: PlaceNewSectionHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:PlaceNewSection extensions.


Details

edit

Use this hook to override the placement of new sections. Return false and put the merged text into $text to override the default behavior.

  • $wikipage : WikiPage object
  • $oldtext : the text of the page before editing
  • $subject : subject of the new section
  • &$text : text of the new section (the contents of the edit form)