Manual:Hooks/PersonalUrls/de

From Linux Web Expert

PersonalUrls
<translate> Available from <tvar name=1><translate> version <tvar (r14138, codereview)</tvar></translate>
<translate> Removed in <tvar name=1><translate> version <tvar (Gerrit change 959839)</tvar></translate>
Called after the personal URLs have been set up, before they are shown.
<translate> Define function:</translate>
public static function onPersonalUrls( array &$personal_urls, Title $title, SkinTemplate $skin ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"PersonalUrls": "MediaWiki\\Extension\\MyExtension\\Hooks::onPersonalUrls"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> skins/SkinTemplate.php
<translate> Interface:</translate> PersonalUrlsHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Handbuch:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:PersonalUrls extensions/de</tvar>.</translate>

Details

  • $personal_urls: the array of URLs set up so far
  • $title: the Title object of the current article
  • $skin: SkinTemplate object providing context (e.g. to check if the user is logged in, etc.) - since 1.23 (gerrit:95776)

personal_urls items format

Each line of the array is composed from an array, containing 4 items:
Key Beschreibung
text The link text
href The link URL
active Determines if this link is the active page
class Custom CSS class for the link (e.g. new if the page doesn't exist)
icon Icon identifier, for use in skins which support it, e.g. Vector (2022)

Only text and href are mandatory.

List of PersonalUrls

In a vanilla MediaWiki install, the $personal_urls contains the following entries:

Key Beschreibung Target page sample
userpage & anonuserpage The user page User:John Doe
mytalk & anontalk Die Benutzerdiskussionsseite User talk:John Doe
preferences The preferences special page Special:Preferences
watchlist The user watchlist Special:Watchlist
mycontris The user contributions page Special:Contributions/John Doe
logout The logout page Special:UserLogout
createaccount The registration page Special:Createaccount
login & anonlogin The login page Special:UserLogin