Utility class to format entity links with labels for usage in hooks.
More...
|
| __construct (Language $pageLanguage, EntityTitleTextLookup $entityTitleTextLookup) |
|
| getFragment (EntityId $entityId, $fragment) |
| Optionally update the fragment of the link.
|
|
| 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.
|
|
Utility class to format entity links with labels for usage in hooks.
◆ __construct()
Wikibase\Repo\Hooks\Formatters\DefaultEntityLinkFormatter::__construct |
( |
Language |
$pageLanguage, |
|
|
EntityTitleTextLookup |
$entityTitleTextLookup |
|
) |
| |
◆ extractTextAndLanguage()
Wikibase\Repo\Hooks\Formatters\DefaultEntityLinkFormatter::extractTextAndLanguage |
( |
array |
$termData = null | ) |
|
|
private |
- Parameters
-
string[] | null | $termData | A term record as returned by LanguageFallbackChain::extractPreferredValueOrAny(), containing the 'value' and 'language' fields, or null or an empty array. |
- See also
- LanguageFallbackChain::extractPreferredValueOrAny
- Returns
- array list( string $text, Language $language )
◆ getFragment()
Wikibase\Repo\Hooks\Formatters\DefaultEntityLinkFormatter::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 | $fragment | The current fragment of the link, not including an initial '#'. |
- Returns
- string The new fragment (or the same as $fragment), not including an initial '#'.
Implements Wikibase\Repo\Hooks\Formatters\EntityLinkFormatter.
◆ $entityTitleTextLookup
Wikibase\Repo\Hooks\Formatters\DefaultEntityLinkFormatter::$entityTitleTextLookup |
|
private |
◆ $pageLanguage
Wikibase\Repo\Hooks\Formatters\DefaultEntityLinkFormatter::$pageLanguage |
|
private |
The documentation for this class was generated from the following file: