Manual:Hooks/PlaceNewSection

From Linux Web Expert

PlaceNewSection
<translate> Available from <tvar name=1><translate> version <tvar (r101096, codereview)</tvar></translate>
Override placement of new sections.
<translate> Define function:</translate>
public static function onPlaceNewSection( $wikipage, $oldtext, $subject, &$text ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"PlaceNewSection": "MediaWiki\\Extension\\MyExtension\\Hooks::onPlaceNewSection"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> page/WikiPage.php
<translate> Interface:</translate> PlaceNewSectionHook.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:PlaceNewSection extensions</tvar>.</translate>


Details

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)