Manual:Hooks/EditSectionLink

From Linux Web Expert

EditSectionLink
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
<translate> Removed in <tvar name=1><translate> version <tvar </tvar></translate>
Override the return value of Linker::editSectionLink()
<translate> Define function:</translate>
public static function onEditSectionLink( $skin, $title, $section, $link, $result ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"EditSectionLink": "MediaWiki\\Extension\\MyExtension\\Hooks::onEditSectionLink"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> Linker.php
<translate> Interface:</translate> EditSectionLinkHook.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:EditSectionLink extensions</tvar>.</translate>


Details

  • $skin: Skin rendering the UI
  • $title: Title being linked to
  • $section: Section to link to
  • $link: Default link
  • $result: Result (alter this to override the generated links)

Can be used to change, modify, add links on the right side of the section header. Also, there's a system message called editsection-brackets which allows you to customise the format of the edit links further to make them into images etc. The final result is wrapped in a span with class attribute set to "editsection" so that further CSS styles can be applied.