|
| __construct (LanguageLinkBadgeDisplay $badgeDisplay, NamespaceChecker $namespaceChecker, SiteLinksForDisplayLookup $siteLinkForDisplayLookup, SiteLookup $siteLookup, $siteId, $siteGroup) |
|
| useRepoLinks (Title $title, ParserOutput $out) |
| Checks if a page have interwiki links from Wikidata repo? Disabled for a page when either:
|
|
| suppressRepoLinks (ParserOutput $out, array $repoLinks) |
| Returns a filtered version of $repoLinks, containing only links that should be considered for combining with the local inter-language links.
|
|
| filterRepoLinksByGroup (array $repoLinks, array $allowedGroups) |
| Filters the given list of links by site group: Any links pointing to a site that is not in $allowedGroups will be removed.
|
|
| getNoExternalLangLinks (ParserOutput $out) |
| Get the noexternallanglinks page property from the ParserOutput, which is set by the {{#noexternallanglinks}} parser function.
|
|
| getEffectiveRepoLinks (Title $title, ParserOutput $out) |
| Look up sitelinks for the given title on the repository and filter them taking into account any applicable configuration and any use of the {{#noexternallanglinks}} function on the page.
|
|
| addLinksFromRepository (Title $title, ParserOutput $out) |
| Look up sitelinks for the given title on the repository and add them to the ParserOutput object, taking into account any applicable configuration and any use of the {{#noexternallanglinks}} function on the page.
|
|
| getInterwikiCodeFromSite (Site $site) |
| Extracts the local interwiki code, which in case of the wikimedia site groups, is always the global id's prefix.
|
|
|
| indexLinksByInterwiki (array $links) |
|
| localLinksToArray (array $flatLinks) |
| Converts a list of interwiki links into an associative array that maps global site IDs to the respective target pages on the designated wikis.
|
|
| addLinksToOutput (array $links, ParserOutput $out) |
| Adds the given SiteLinks to the given ParserOutput.
|
|
- Todo:
- split this up and find a better home for stuff that adds parser output properties and extension data.
- Copyright
- GPL-2.0-or-later
- Author
- Nikola Smolenski smole.nosp@m.nsk@.nosp@m.eunet.nosp@m..rs
-
Daniel Kinzler
-
Katie Filbert < aude..nosp@m.wiki.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >
◆ __construct()
- Parameters
-
LanguageLinkBadgeDisplay | $badgeDisplay | |
NamespaceChecker | $namespaceChecker | determines which namespaces wikibase is enabled on |
SiteLinksForDisplayLookup | $siteLinkForDisplayLookup | |
SiteLookup | $siteLookup | |
string | $siteId | The global site ID for the local wiki |
string | $siteGroup | The ID of the site group to use for showing language links. |
◆ addLinksFromRepository()
Wikibase\Client\Hooks\LangLinkHandler::addLinksFromRepository |
( |
Title |
$title, |
|
|
ParserOutput |
$out |
|
) |
| |
Look up sitelinks for the given title on the repository and add them to the ParserOutput object, taking into account any applicable configuration and any use of the {{#noexternallanglinks}} function on the page.
The language links are not sorted, call sortLanguageLinks() to do that.
- Parameters
-
Title | $title | The page's title |
ParserOutput | $out | Parsed representation of the page |
◆ addLinksToOutput()
Wikibase\Client\Hooks\LangLinkHandler::addLinksToOutput |
( |
array |
$links, |
|
|
ParserOutput |
$out |
|
) |
| |
|
private |
Adds the given SiteLinks to the given ParserOutput.
- Parameters
-
SiteLink[] | $links | |
ParserOutput | $out | |
◆ filterRepoLinksByGroup()
Wikibase\Client\Hooks\LangLinkHandler::filterRepoLinksByGroup |
( |
array |
$repoLinks, |
|
|
array |
$allowedGroups |
|
) |
| |
Filters the given list of links by site group: Any links pointing to a site that is not in $allowedGroups will be removed.
- Parameters
-
array | $repoLinks | An array that uses global site IDs as keys. |
string[] | $allowedGroups | A list of allowed site groups |
- Returns
- array A filtered copy of $repoLinks, retaining only the links pointing to a site in an allowed group.
◆ getEffectiveRepoLinks()
Wikibase\Client\Hooks\LangLinkHandler::getEffectiveRepoLinks |
( |
Title |
$title, |
|
|
ParserOutput |
$out |
|
) |
| |
Look up sitelinks for the given title on the repository and filter them taking into account any applicable configuration and any use of the {{#noexternallanglinks}} function on the page.
The result is an associative array of links that should be added to the current page, excluding any target sites for which there already is a link on the page.
- Parameters
-
Title | $title | The page's title |
ParserOutput | $out | Parsed representation of the page |
- Returns
- SiteLink[] An associative array, using site IDs for keys and the target pages in the respective languages as the associated value.
◆ getInterwikiCodeFromSite()
Wikibase\Client\Hooks\LangLinkHandler::getInterwikiCodeFromSite |
( |
Site |
$site | ) |
|
Extracts the local interwiki code, which in case of the wikimedia site groups, is always the global id's prefix.
@fixme put somewhere more sane and use site identifiers data, so that this works in non-wikimedia cases where the assumption is not true.
- Parameters
-
- Returns
- string
◆ getNoExternalLangLinks()
Wikibase\Client\Hooks\LangLinkHandler::getNoExternalLangLinks |
( |
ParserOutput |
$out | ) |
|
Get the noexternallanglinks page property from the ParserOutput, which is set by the {{#noexternallanglinks}} parser function.
- See also
- NoLangLinkHandler::getNoExternalLangLinks
- Parameters
-
- Returns
- string[] A list of language codes, identifying which repository links to ignore. Empty if {{#noexternallanglinks}} was not used on the page.
◆ indexLinksByInterwiki()
Wikibase\Client\Hooks\LangLinkHandler::indexLinksByInterwiki |
( |
array |
$links | ) |
|
|
private |
- Parameters
-
- Returns
- SiteLink[] The SiteLinks in $links, indexed by interwiki prefix.
◆ localLinksToArray()
Wikibase\Client\Hooks\LangLinkHandler::localLinksToArray |
( |
array |
$flatLinks | ) |
|
|
private |
Converts a list of interwiki links into an associative array that maps global site IDs to the respective target pages on the designated wikis.
- Parameters
-
- Returns
- string[] An associative array, using site IDs for keys and the target pages on the respective wiki as the associated value.
◆ suppressRepoLinks()
Wikibase\Client\Hooks\LangLinkHandler::suppressRepoLinks |
( |
ParserOutput |
$out, |
|
|
array |
$repoLinks |
|
) |
| |
Returns a filtered version of $repoLinks, containing only links that should be considered for combining with the local inter-language links.
This takes into account the {{#noexternallanglinks}} parser function, and also removed any link to this wiki itself.
This function does not remove links to wikis for which there is already an inter-language link defined in the local wikitext. This is done later by getEffectiveRepoLinks().
- Parameters
-
ParserOutput | $out | |
array | $repoLinks | An array that uses global site IDs as keys. |
- Returns
- SiteLink[] A filtered copy of $repoLinks, with any inappropriate entries removed.
◆ useRepoLinks()
Wikibase\Client\Hooks\LangLinkHandler::useRepoLinks |
( |
Title |
$title, |
|
|
ParserOutput |
$out |
|
) |
| |
Checks if a page have interwiki links from Wikidata repo? Disabled for a page when either:
- Wikidata not enabled for namespace
- nel parser function = * (suppress all repo links)
- Parameters
-
Title | $title | |
ParserOutput | $out | |
- Returns
- bool
◆ $badgeDisplay
Wikibase\Client\Hooks\LangLinkHandler::$badgeDisplay |
|
private |
◆ $namespaceChecker
Wikibase\Client\Hooks\LangLinkHandler::$namespaceChecker |
|
private |
◆ $siteGroup
Wikibase\Client\Hooks\LangLinkHandler::$siteGroup |
|
private |
◆ $siteId
Wikibase\Client\Hooks\LangLinkHandler::$siteId |
|
private |
◆ $siteLinksForDisplayLookup
Wikibase\Client\Hooks\LangLinkHandler::$siteLinksForDisplayLookup |
|
private |
◆ $siteLookup
Wikibase\Client\Hooks\LangLinkHandler::$siteLookup |
|
private |
The documentation for this class was generated from the following file: