Manual:LinkRenderer.php/de

is a class to create HTML links for a specific title. It was refactored out of the class in MediaWiki 1.28.

Getting a LinkRenderer instance
In general, the easiest way to get a  instance is from  :

This will provide you with an instance prepared for the current user.

Some contexts will have their own LinkRenderer instance, like the or :

If you need to set custom options (see below), you can create your own! You shouldn't modify the main instances since that will affect the entire request state.

Making links
Okay, you now have a LinkRenderer instance. Let's make some links! At the very minimum you'll need a  or   target to link to. The examples below all use TitleValue for simplicity, but the equivalent Title object can be used as well.

Will give you:

Wenn du den Linktext ändern möchtest:

This text will automatically be escaped (different from its Linker predecessor). If you need to include HTML, you can armor the content:

Optionen
LinkRenderer has a few options that are set per-instance and can be customized:


 * ForceArticlePath ( / ) - Forces the link to use the article path (see ) even if a query string is present, resulting in URLs like.
 * ExpandURLs ( / ) - Controls whether the URL should be expanded, and can be set to any of the  constants.
 * StubThreshold ( / ) - Threshold at which articles should be marked with the  CSS class. Using  will automatically set this.