Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary Class Reference

Registers and defines functions to access Wikibase through the Scribunto extension. More...

+ Inheritance diagram for Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary:
+ Collaboration diagram for Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary:

Public Member Functions

 getUsageAccumulator ()
 
 addStatementUsage (string $entityId, string $propertyId)
 Add a statement usage (called once specific statements are accessed).
 
 addLabelUsage (string $entityId, ?string $langCode)
 Add a label usage (called once specific labels are accessed).
 
 addDescriptionUsage (string $entityId, ?string $langCode)
 Add a description usage (called once specific descriptions are accessed).
 
 addTitleOrSiteLinksUsage (string $entityId, ?string $requestedSiteId)
 Add a sitelinks usage (called once specific sitelinks are accessed).
 
 addOtherUsage (string $entityId)
 Add an other (O) usage (called once the otherwise not covered aspect is used).
 
 register ()
 Register mw.wikibase.entity.lua library.
 
 formatPropertyValues (string $entityId, string $propertyLabelOrId, ?array $acceptableRanks)
 Format the main Snaks belonging to a Statement (which is identified by a NumericPropertyId or the label of a Property) as wikitext escaped plain text.
 
 formatStatements (string $entityId, string $propertyLabelOrId, ?array $acceptableRanks)
 Format the main Snaks belonging to a Statement (which is identified by a NumericPropertyId or the label of a Property) as rich wikitext.
 
 incrementStatsKey (string $key)
 Increment the given stats key.
 
 getParserOutput ()
 

Private Member Functions

 getImplementation ()
 
 newImplementation ()
 
 newRichWikitextSnakFormatter (DataAccessSnakFormatterFactory $snakFormatterFactory, Language $lang)
 
 getLuaFunctionCallTracker ()
 
 getLanguage ()
 Returns the language to use.
 
 allowDataAccessInUserLanguage ()
 

Private Attributes

 $wbLibrary
 
 $luaFunctionCallTracker = null
 

Detailed Description

Registers and defines functions to access Wikibase through the Scribunto extension.

Author
Marius Hoch < hoo@o.nosp@m.nlin.nosp@m.e.de >
Andrew Hall

Member Function Documentation

◆ addDescriptionUsage()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::addDescriptionUsage ( string $entityId,
?string $langCode )

Add a description usage (called once specific descriptions are accessed).

Parameters
string$entityIdThe Entity from which the descriptions were accessed.
string | null$langCodeLanguage code of the descriptions accessed.

◆ addLabelUsage()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::addLabelUsage ( string $entityId,
?string $langCode )

Add a label usage (called once specific labels are accessed).

Parameters
string$entityIdThe Entity from which the labels were accessed.
string | null$langCodeLanguage code of the labels accessed.

◆ addOtherUsage()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::addOtherUsage ( string $entityId)

Add an other (O) usage (called once the otherwise not covered aspect is used).

Parameters
string$entityIdThe Entity from which something was accessed.

◆ addStatementUsage()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::addStatementUsage ( string $entityId,
string $propertyId )

Add a statement usage (called once specific statements are accessed).

Parameters
string$entityIdThe Entity from which the statements were accessed.
string$propertyIdProperty id of the statements accessed.

◆ addTitleOrSiteLinksUsage()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::addTitleOrSiteLinksUsage ( string $entityId,
?string $requestedSiteId )

Add a sitelinks usage (called once specific sitelinks are accessed).

Parameters
string$entityIdThe Entity from which the sitelinks were accessed.
string | null$requestedSiteIdThe site for which a specific sitelink is requested.

◆ allowDataAccessInUserLanguage()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::allowDataAccessInUserLanguage ( )
private

◆ formatPropertyValues()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::formatPropertyValues ( string $entityId,
string $propertyLabelOrId,
?array $acceptableRanks )

Format the main Snaks belonging to a Statement (which is identified by a NumericPropertyId or the label of a Property) as wikitext escaped plain text.

Parameters
string$entityId
string$propertyLabelOrId
int[] | null$acceptableRanks
Exceptions
ScribuntoException
Returns
string[]|null[]

◆ formatStatements()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::formatStatements ( string $entityId,
string $propertyLabelOrId,
?array $acceptableRanks )

Format the main Snaks belonging to a Statement (which is identified by a NumericPropertyId or the label of a Property) as rich wikitext.

Parameters
string$entityId
string$propertyLabelOrId
int[] | null$acceptableRanks
Exceptions
ScribuntoException
Returns
string[]|null[]

◆ getImplementation()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::getImplementation ( )
private

◆ getLanguage()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::getLanguage ( )
private

Returns the language to use.

If we are on a multilingual wiki (allowDataAccessInUserLanguage is true) this will be the user's interface language, otherwise it will be the content language. In a perfect world, this would equal Parser::getTargetLanguage.

This can probably be removed after T114640 has been implemented.

Please note, that this splits the parser cache by user language, if allowDataAccessInUserLanguage is true.

◆ getLuaFunctionCallTracker()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::getLuaFunctionCallTracker ( )
private

◆ getParserOutput()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::getParserOutput ( )

◆ getUsageAccumulator()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::getUsageAccumulator ( )

◆ incrementStatsKey()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::incrementStatsKey ( string $key)

Increment the given stats key.

◆ newImplementation()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::newImplementation ( )
private

◆ newRichWikitextSnakFormatter()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::newRichWikitextSnakFormatter ( DataAccessSnakFormatterFactory $snakFormatterFactory,
Language $lang )
private

◆ register()

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::register ( )

Register mw.wikibase.entity.lua library.

Returns
array

Member Data Documentation

◆ $luaFunctionCallTracker

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::$luaFunctionCallTracker = null
private

◆ $wbLibrary

Wikibase\Client\DataAccess\Scribunto\WikibaseEntityLibrary::$wbLibrary
private

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