MediaWiki  master
MediaWiki\Linker\LinkTarget Interface Reference
Inheritance diagram for MediaWiki\Linker\LinkTarget:

Public Member Functions

 __toString ()
 Returns an informative human readable representation of the page identity, for use in logging and debugging. More...
 
 createFragmentTarget ( $fragment)
 Creates a new LinkTarget for a different fragment of the same page. More...
 
 getDBkey ()
 Get the main part with underscores. More...
 
 getFragment ()
 Get the link fragment (i.e. More...
 
 getInterwiki ()
 The interwiki component of this LinkTarget. More...
 
 getNamespace ()
 Get the namespace index. More...
 
 getText ()
 Returns the link in text form, without namespace prefix or fragment. More...
 
 hasFragment ()
 Whether the link target has a fragment. More...
 
 inNamespace ( $ns)
 Convenience function to test if it is in the namespace. More...
 
 isExternal ()
 Whether this LinkTarget has an interwiki component. More...
 
 isSameLinkAs (LinkTarget $other)
 Checks whether the given LinkTarget refers to the same target as this LinkTarget. More...
 

Detailed Description

Since
1.27

Definition at line 26 of file LinkTarget.php.

Member Function Documentation

◆ __toString()

MediaWiki\Linker\LinkTarget::__toString ( )

Returns an informative human readable representation of the page identity, for use in logging and debugging.

Returns
string

Implemented in TitleValue, and Title.

◆ createFragmentTarget()

MediaWiki\Linker\LinkTarget::createFragmentTarget (   $fragment)

Creates a new LinkTarget for a different fragment of the same page.

It is expected that the same type of object will be returned, but the only requirement is that it is a LinkTarget.

Since
1.27
Parameters
string$fragmentThe fragment name, or "" for the entire page.
Returns
LinkTarget

Implemented in TitleValue, and Title.

Referenced by MediaWiki\Linker\LinkRenderer\makeBrokenLink().

◆ getDBkey()

◆ getFragment()

MediaWiki\Linker\LinkTarget::getFragment ( )

Get the link fragment (i.e.

the bit after the #) in text form.

Since
1.27
Returns
string link fragment

Implemented in TitleValue, and Title.

Referenced by MediaWiki\Linker\LinkRenderer\getLinkText(), Title\isSameLinkAs(), TitleValue\isSameLinkAs(), Linker\makeCommentLink(), Title\newFromLinkTarget(), and MediaWiki\Linker\LinkRenderer\normalizeTarget().

◆ getInterwiki()

MediaWiki\Linker\LinkTarget::getInterwiki ( )

◆ getNamespace()

◆ getText()

MediaWiki\Linker\LinkTarget::getText ( )

Returns the link in text form, without namespace prefix or fragment.

This is computed from the DB key by replacing any underscores with spaces.

Since
1.27
Returns
string

Implemented in TitleValue, and Title.

Referenced by NamespaceInfo\canHaveTalkPage(), Title\compare(), LanguageConverter\convertTitle(), NamespaceInfo\getAssociatedPage(), NamespaceInfo\getTalkPage(), and Title\newFromLinkTarget().

◆ hasFragment()

MediaWiki\Linker\LinkTarget::hasFragment ( )

Whether the link target has a fragment.

Since
1.27
Returns
bool

Implemented in TitleValue, and Title.

Referenced by MediaWiki\Linker\LinkRenderer\getLinkText(), and MediaWiki\Linker\LinkRenderer\makeBrokenLink().

◆ inNamespace()

MediaWiki\Linker\LinkTarget::inNamespace (   $ns)

Convenience function to test if it is in the namespace.

Since
1.27
Parameters
int$ns
Returns
bool

Implemented in TitleValue, and Title.

◆ isExternal()

MediaWiki\Linker\LinkTarget::isExternal ( )

Whether this LinkTarget has an interwiki component.

Since
1.27
Returns
bool

Implemented in TitleValue, and Title.

Referenced by LinkCache\addLinkObj(), Linker\makeCommentLink(), MediaWiki\Linker\LinkRenderer\makeKnownLink(), and MediaWiki\Linker\LinkRenderer\normalizeTarget().

◆ isSameLinkAs()

MediaWiki\Linker\LinkTarget::isSameLinkAs ( LinkTarget  $other)

Checks whether the given LinkTarget refers to the same target as this LinkTarget.

Two link targets are considered the same if they have the same interwiki prefix, the same namespace ID, the same text, and the same fragment.

Since
1.36
Parameters
LinkTarget$other
Returns
bool

Implemented in TitleValue, and Title.


The documentation for this interface was generated from the following file: