Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Client\Hooks\SidebarLinkBadgeDisplay Class Reference

Basic display logic to output badges in the sidebar. More...

Public Member Functions

 __construct (LabelDescriptionLookup $labelDescriptionLookup, array $badgeClassNames, Language $language)
 
 applyBadgeToLink (array &$sidebarLink, array $badgeInfo)
 Applies the badges described in the wikibase_badges property of $output to the language link.
 
 getBadgeInfo (array $badgeIds)
 Builds badge information for the given badges.
 

Private Member Functions

 getLabel (ItemId $badgeId)
 Returns the label for the given badge.
 

Private Attributes

 $labelDescriptionLookup
 
 $badgeClassNames
 
 $language
 

Detailed Description

Basic display logic to output badges in the sidebar.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Client\Hooks\SidebarLinkBadgeDisplay::__construct ( LabelDescriptionLookup $labelDescriptionLookup,
array $badgeClassNames,
Language $language )
Parameters
LabelDescriptionLookup$labelDescriptionLookup
string[]$badgeClassNames
Language$language

Member Function Documentation

◆ applyBadgeToLink()

Wikibase\Client\Hooks\SidebarLinkBadgeDisplay::applyBadgeToLink ( array & $sidebarLink,
array $badgeInfo )

Applies the badges described in the wikibase_badges property of $output to the language link.

This is generally called in the context of generating skin output.

Parameters
string[]&$sidebarLink
string[]$badgeInfoAn associative array with the keys 'class' and 'label' with assigned string values. These fields are the one outputted by the getBadgeInfo() function.

◆ getBadgeInfo()

Wikibase\Client\Hooks\SidebarLinkBadgeDisplay::getBadgeInfo ( array $badgeIds)

Builds badge information for the given badges.

CSS classes are derived from the given list of badges, and any extra badge class names specified in the badgeClassNames setting are added. For badges that have a such an extra class name assigned, this also adds a title according to the items' labels. Other badges do not have labels added to the link's title attribute, so the can be effectively ignored on this client wiki.

Parameters
ItemId[]$badgeIds
Returns
string[] An associative array with the keys 'class' and 'label' with assigned string values. These fields correspond to the fields in the description array for language links used by the SkinTemplateGetLanguageLink hook and expected by the applyBadgeToLink() function.

◆ getLabel()

Wikibase\Client\Hooks\SidebarLinkBadgeDisplay::getLabel ( ItemId $badgeId)
private

Returns the label for the given badge.

Parameters
ItemId$badgeId
Returns
string|null

Member Data Documentation

◆ $badgeClassNames

Wikibase\Client\Hooks\SidebarLinkBadgeDisplay::$badgeClassNames
private

◆ $labelDescriptionLookup

Wikibase\Client\Hooks\SidebarLinkBadgeDisplay::$labelDescriptionLookup
private

◆ $language

Wikibase\Client\Hooks\SidebarLinkBadgeDisplay::$language
private

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