Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Client\Store\DescriptionLookup Class Reference

Retrieves up page descriptions. More...

Public Member Functions

 __construct (EntityIdLookup $idLookup, TermBuffer $termLookup, PageProps $pageProps)
 
 getDescriptions (array $titles, $sources, &$actualSources=null)
 Look up descriptions for a set of pages.
 
 getDescription (Title $title, $sources, &$actualSource=null)
 Look up description of a page.
 

Public Attributes

const SOURCE_LOCAL = 'local'
 Local description, in the form of a {{SHORTDESC:...}} parser function.
 
const SOURCE_CENTRAL = 'central'
 Central description, from a associated Wikibase repo installation.
 
const LOCAL_PROPERTY_NAME = 'wikibase-shortdesc'
 page_props key.
 

Private Member Functions

 getLocalDescriptions (array $titlesByPageId)
 Look up local descriptions (stored in the page wikitext via parser function) for a set of pages.
 
 getCentralDescriptions (array $titlesByPageId)
 Look up central descriptions (stored in a linked Wikibase instance) for a set of pages.
 

Private Attributes

 $idLookup
 
 $termLookup
 
 $pageProps
 

Detailed Description

Retrieves up page descriptions.

A description is an explanation of what the page is about, in the content language of the page, short enough that it can be used in interface elements such as dropdowns to contextualize or disambiguate pages.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Client\Store\DescriptionLookup::__construct ( EntityIdLookup $idLookup,
TermBuffer $termLookup,
PageProps $pageProps )

Member Function Documentation

◆ getCentralDescriptions()

Wikibase\Client\Store\DescriptionLookup::getCentralDescriptions ( array $titlesByPageId)
private

Look up central descriptions (stored in a linked Wikibase instance) for a set of pages.

Parameters
Title[]$titlesByPageIdAssociative array of page ID => Title object.
Returns
string[] Associative array of page ID => description.

◆ getDescription()

Wikibase\Client\Store\DescriptionLookup::getDescription ( Title $title,
$sources,
& $actualSource = null )

Look up description of a page.

Convenience wrapper for getDescriptions().

Parameters
Title$titleTitle to look up (will be loaded).
array | string$sourcesOne or both of the DescriptionLookup::SOURCE_* constants. When an array is provided, the second element will be used as fallback.
string | null&$actualSourceWill be set to one of the DescriptionLookup::SOURCE_* constants, indicating where the description came from, or null if no description was found.
Returns
string|null The description, or null if none was found.

◆ getDescriptions()

Wikibase\Client\Store\DescriptionLookup::getDescriptions ( array $titles,
$sources,
& $actualSources = null )

Look up descriptions for a set of pages.

Parameters
Title[]$titlesTitles to look up (will be loaded).
array | string$sourcesOne or both of the DescriptionLookup::SOURCE_* constants. When an array is provided, the second element will be used as fallback.
array | null&$actualSourcesWill be set to an associative array of page ID => SOURCE_*, indicating where each description came from, or null if no description was found.
Returns
string[] Associative array of page ID => description. Pages with no description will be omitted.

◆ getLocalDescriptions()

Wikibase\Client\Store\DescriptionLookup::getLocalDescriptions ( array $titlesByPageId)
private

Look up local descriptions (stored in the page wikitext via parser function) for a set of pages.

Parameters
Title[]$titlesByPageIdAssociative array of page ID => Title object.
Returns
string[] Associative array of page ID => description.

Member Data Documentation

◆ $idLookup

Wikibase\Client\Store\DescriptionLookup::$idLookup
private

◆ $pageProps

Wikibase\Client\Store\DescriptionLookup::$pageProps
private

◆ $termLookup

Wikibase\Client\Store\DescriptionLookup::$termLookup
private

◆ LOCAL_PROPERTY_NAME

const Wikibase\Client\Store\DescriptionLookup::LOCAL_PROPERTY_NAME = 'wikibase-shortdesc'

page_props key.

◆ SOURCE_CENTRAL

const Wikibase\Client\Store\DescriptionLookup::SOURCE_CENTRAL = 'central'

Central description, from a associated Wikibase repo installation.

◆ SOURCE_LOCAL

const Wikibase\Client\Store\DescriptionLookup::SOURCE_LOCAL = 'local'

Local description, in the form of a {{SHORTDESC:...}} parser function.


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