MediaWiki master
MediaWiki\Linker\UserLinkRenderer Class Reference

Service class that renders HTML for user-related links. More...

Public Member Functions

 __construct (HookContainer $hookContainer, TempUserConfig $tempUserConfig, SpecialPageFactory $specialPageFactory, LinkRenderer $linkRenderer, TempUserDetailsLookup $tempUserDetailsLookup, UserIdentityLookup $userIdentityLookup, UserNameUtils $userNameUtils)
 
 getLinkClasses (LinkTarget $target, bool $isDefaultCaption=false)
 Convenience function for LinkRenderer: return the CSS classes to add to a given LinkTarget if it represents a link to a user.
 
 userLink (UserIdentity $targetUser, IContextSource $context, ?string $altUserName=null, array $attributes=[])
 Render a user page link (or user contributions for anonymous and temporary users).
 

Protected Member Functions

 isFromExternalWiki ( $wikiId)
 Checks whether a given wiki identifier belongs to an external wiki.
 

Detailed Description

Service class that renders HTML for user-related links.

Since
1.44
Access: internal
Call via LinkRenderer::userLink(), not directly.

Definition at line 31 of file UserLinkRenderer.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Linker\UserLinkRenderer::__construct ( HookContainer $hookContainer,
TempUserConfig $tempUserConfig,
SpecialPageFactory $specialPageFactory,
LinkRenderer $linkRenderer,
TempUserDetailsLookup $tempUserDetailsLookup,
UserIdentityLookup $userIdentityLookup,
UserNameUtils $userNameUtils )

Definition at line 49 of file UserLinkRenderer.php.

Member Function Documentation

◆ getLinkClasses()

MediaWiki\Linker\UserLinkRenderer::getLinkClasses ( LinkTarget $target,
bool $isDefaultCaption = false )

Convenience function for LinkRenderer: return the CSS classes to add to a given LinkTarget if it represents a link to a user.

See also
::getLinkClassesFromUserName() for details on the classes applied.
LinkRenderer::isDefaultLinkCaption() for the definition of a 'default' caption.
Access: internal
For use by LinkRenderer::getLinkClasses()

Definition at line 361 of file UserLinkRenderer.php.

References MediaWiki\Linker\LinkTarget\getText().

◆ isFromExternalWiki()

MediaWiki\Linker\UserLinkRenderer::isFromExternalWiki ( $wikiId)
protected

Checks whether a given wiki identifier belongs to an external wiki.

Parameters
string | false$wikiIdID to check
Returns
bool true if the ID belongs to an external wiki, false otherwise.

Definition at line 318 of file UserLinkRenderer.php.

◆ userLink()

MediaWiki\Linker\UserLinkRenderer::userLink ( UserIdentity $targetUser,
IContextSource $context,
?string $altUserName = null,
array $attributes = [] )

Render a user page link (or user contributions for anonymous and temporary users).

Returns potentially cached link HTML.

Parameters
UserIdentity$targetUserThe user to render a link for.
IContextSource$context
string | null$altUserNameOptional text to display instead of the user name, or null to use the user name.
array<string,string>$attributes Optional extra HTML attributes for the link.
Returns
string HTML fragment
Deprecated
since 1.45, use LinkRenderer::makeUserLink() instead.

Definition at line 83 of file UserLinkRenderer.php.

References MediaWiki\DAO\WikiAwareEntity\getWikiId().


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