Manual:Hooks/PlaceNewSection

From MediaWiki.org
Jump to navigation Jump to search
PlaceNewSection
Available from version 1.19.0 (r101096)
Override placement of new sections.
Define function:
public static function onPlaceNewSection( $wikipage, $oldtext, $subject, &$text ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"PlaceNewSection": "MyExtensionHooks::onPlaceNewSection"
	}
}

For MediaWiki ≤1.25:

$wgHooks['PlaceNewSection'][] = 'MyExtensionHooks::onPlaceNewSection';
Called from: File(s): WikiPage.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)