MediaWiki  master
MediaWiki\Linker\LinkRenderer Class Reference

Class that generates HTML anchor link elements for pages. More...

Public Member Functions

 __construct (TitleFormatter $titleFormatter, LinkCache $linkCache, SpecialPageFactory $specialPageFactory, HookContainer $hookContainer, ServiceOptions $options)
 
 getExpandURLs ()
 
 getForceArticlePath ()
 
 getLinkClasses ( $target)
 Return the CSS classes of a known link. More...
 
 isForComment ()
 
 makeBrokenLink ( $target, $text=null, array $extraAttribs=[], array $query=[])
 
 makeKnownLink ( $target, $text=null, array $extraAttribs=[], array $query=[])
 
 makeLink ( $target, $text=null, array $extraAttribs=[], array $query=[])
 
 makePreloadedLink ( $target, $text=null, $classes='', array $extraAttribs=[], array $query=[])
 If you have already looked up the proper CSS classes using LinkRenderer::getLinkClasses() or some other method, use this to avoid looking it up again. More...
 
 normalizeTarget ( $target)
 Normalizes the provided target. More...
 
 setExpandURLs ( $expand)
 
 setForceArticlePath ( $force)
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Detailed Description

Class that generates HTML anchor link elements for pages.

See also
https://www.mediawiki.org/wiki/Manual:LinkRenderer
Since
1.28

Definition at line 43 of file LinkRenderer.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Linker\LinkRenderer::__construct ( TitleFormatter  $titleFormatter,
LinkCache  $linkCache,
SpecialPageFactory  $specialPageFactory,
HookContainer  $hookContainer,
ServiceOptions  $options 
)
Access: internal
For use by LinkRendererFactory
Parameters
TitleFormatter$titleFormatter
LinkCache$linkCache
SpecialPageFactory$specialPageFactory
HookContainer$hookContainer
ServiceOptions$options

Definition at line 97 of file LinkRenderer.php.

References MediaWiki\Config\ServiceOptions\assertRequiredOptions(), and MediaWiki\Config\ServiceOptions\get().

Member Function Documentation

◆ getExpandURLs()

MediaWiki\Linker\LinkRenderer::getExpandURLs ( )
Returns
string|bool|int a PROTO_* constant or false

Definition at line 137 of file LinkRenderer.php.

◆ getForceArticlePath()

MediaWiki\Linker\LinkRenderer::getForceArticlePath ( )
Returns
bool

Definition at line 123 of file LinkRenderer.php.

◆ getLinkClasses()

MediaWiki\Linker\LinkRenderer::getLinkClasses (   $target)

Return the CSS classes of a known link.

Parameters
LinkTarget | PageReference$target
Returns
string CSS class

Definition at line 417 of file LinkRenderer.php.

◆ isForComment()

MediaWiki\Linker\LinkRenderer::isForComment ( )

Definition at line 141 of file LinkRenderer.php.

◆ makeBrokenLink()

MediaWiki\Linker\LinkRenderer::makeBrokenLink (   $target,
  $text = null,
array  $extraAttribs = [],
array  $query = [] 
)
Parameters
LinkTarget | PageReference$target
-taint$targetnone
string | HtmlArmor | null$text
array$extraAttribs
array$query
Returns
string

Definition at line 258 of file LinkRenderer.php.

References NS_SPECIAL, and wfMessage().

◆ makeKnownLink()

MediaWiki\Linker\LinkRenderer::makeKnownLink (   $target,
  $text = null,
array  $extraAttribs = [],
array  $query = [] 
)
Parameters
LinkTarget | PageReference$target
string | HtmlArmor | null$text
array$extraAttribs
array$query
Returns
string HTML

Definition at line 221 of file LinkRenderer.php.

Referenced by TraditionalImageGallery\getCaptionHtml(), Article\getRedirectHeaderHtml(), and InfoAction\pageInfo().

◆ makeLink()

MediaWiki\Linker\LinkRenderer::makeLink (   $target,
  $text = null,
array  $extraAttribs = [],
array  $query = [] 
)
Parameters
LinkTarget | PageReference$target
string | HtmlArmor | null$text
array$extraAttribs
array$query
Returns
string HTML

Definition at line 153 of file LinkRenderer.php.

Referenced by Article\getRedirectHeaderHtml(), and InfoAction\pageInfo().

◆ makePreloadedLink()

MediaWiki\Linker\LinkRenderer::makePreloadedLink (   $target,
  $text = null,
  $classes = '',
array  $extraAttribs = [],
array  $query = [] 
)

If you have already looked up the proper CSS classes using LinkRenderer::getLinkClasses() or some other method, use this to avoid looking it up again.

Parameters
LinkTarget | PageReference$target
string | HtmlArmor | null$text
string$classesCSS classes to add
array$extraAttribs
array$query
Returns
string

Definition at line 185 of file LinkRenderer.php.

◆ normalizeTarget()

MediaWiki\Linker\LinkRenderer::normalizeTarget (   $target)

Normalizes the provided target.

Definition at line 368 of file LinkRenderer.php.

References NS_SPECIAL.

◆ setExpandURLs()

MediaWiki\Linker\LinkRenderer::setExpandURLs (   $expand)
Parameters
string | bool | int$expandA PROTO_* constant or false

Definition at line 130 of file LinkRenderer.php.

◆ setForceArticlePath()

MediaWiki\Linker\LinkRenderer::setForceArticlePath (   $force)
Parameters
bool$force

Definition at line 116 of file LinkRenderer.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Linker\LinkRenderer::CONSTRUCTOR_OPTIONS
Initial value:
= [
'renderForComment',
]

Definition at line 45 of file LinkRenderer.php.

Referenced by MediaWiki\Linker\LinkRendererFactory\create().


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