Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Hooks\Formatters\EntityLinkFormatter Interface Reference
+ Inheritance diagram for Wikibase\Repo\Hooks\Formatters\EntityLinkFormatter:

Public Member Functions

 getHtml (EntityId $entityId, array $labelData=null)
 Produce link HTML from Entity ID and label data.
 
 getTitleAttribute (EntityId $entityId, array $labelData=null, array $descriptionData=null)
 Get "title" attribute for Wikidata entity link.
 
 getFragment (EntityId $entityId, $fragment)
 Optionally update the fragment of the link.
 

Detailed Description

Member Function Documentation

◆ getFragment()

Wikibase\Repo\Hooks\Formatters\EntityLinkFormatter::getFragment ( EntityId $entityId,
$fragment )

Optionally update the fragment of the link.

This is necessary for subentities, where the link points to a section of the parent entity’s page; if the anchor of that section changes (e.g. from including the parent entity ID to not including it), we want to update the fragment in old links to that entity accordingly. See T208423 for an example of this.

Parameters
EntityId$entityId
string$fragmentThe current fragment of the link, not including an initial '#'.
Returns
string The new fragment (or the same as $fragment), not including an initial '#'.

Implemented in Wikibase\Repo\Hooks\Formatters\DefaultEntityLinkFormatter.

◆ getHtml()

Wikibase\Repo\Hooks\Formatters\EntityLinkFormatter::getHtml ( EntityId $entityId,
array $labelData = null )

Produce link HTML from Entity ID and label data.

Parameters
EntityId$entityId
string[] | null$labelDataArray containing the 'value' and 'language' fields
Returns
string HTML code for the link

◆ getTitleAttribute()

Wikibase\Repo\Hooks\Formatters\EntityLinkFormatter::getTitleAttribute ( EntityId $entityId,
array $labelData = null,
array $descriptionData = null )

Get "title" attribute for Wikidata entity link.

Parameters
EntityId$entityId
string[] | null$labelData
string[] | null$descriptionData
Returns
string The plain, unescaped title="…" attribute for the link.

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