Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\ItemDisambiguation Class Reference

Class representing the disambiguation of a list of WikibaseItems. More...

Public Member Functions

 __construct (EntityTitleLookup $titleLookup, LanguageNameLookup $languageNameLookup, $displayLanguageCode)
 
 getHTML (array $searchResults)
 Builds and returns the HTML to represent the WikibaseItem. More...
 
 getResultHtml (TermSearchResult $searchResult)
 

Private Member Functions

 getIdHtml (EntityId $entityId=null)
 Returns HTML representing the label in the display language (or an appropriate fallback). More...
 
 getLabelHtml (Term $label=null)
 Returns HTML representing the label in the display language (or an appropriate fallback). More...
 
 getDescriptionHtml (Term $description=null)
 Returns HTML representing the description in the display language (or an appropriate fallback). More...
 
 getMatchHtml (Term $match=null, Term $label=null)
 Returns HTML representing the matched term in the search language (or an appropriate fallback). More...
 

Private Attributes

 $titleLookup
 
 $languageNameLookup
 
 $displayLanguageCode
 

Detailed Description

Class representing the disambiguation of a list of WikibaseItems.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\ItemDisambiguation::__construct ( EntityTitleLookup  $titleLookup,
LanguageNameLookup  $languageNameLookup,
  $displayLanguageCode 
)
Parameters
EntityTitleLookup$titleLookup
LanguageNameLookup$languageNameLookup
string$displayLanguageCode

Member Function Documentation

◆ getDescriptionHtml()

Wikibase\Repo\ItemDisambiguation::getDescriptionHtml ( Term  $description = null)
private

Returns HTML representing the description in the display language (or an appropriate fallback).

Parameters
Term | null$description
Returns
string HTML

◆ getHTML()

Wikibase\Repo\ItemDisambiguation::getHTML ( array  $searchResults)

Builds and returns the HTML to represent the WikibaseItem.

Parameters
TermSearchResult[]$searchResults
Returns
string HTML

◆ getIdHtml()

Wikibase\Repo\ItemDisambiguation::getIdHtml ( EntityId  $entityId = null)
private

Returns HTML representing the label in the display language (or an appropriate fallback).

Parameters
EntityId | null$entityId
Returns
string HTML

◆ getLabelHtml()

Wikibase\Repo\ItemDisambiguation::getLabelHtml ( Term  $label = null)
private

Returns HTML representing the label in the display language (or an appropriate fallback).

Parameters
Term | null$label
Returns
string HTML

◆ getMatchHtml()

Wikibase\Repo\ItemDisambiguation::getMatchHtml ( Term  $match = null,
Term  $label = null 
)
private

Returns HTML representing the matched term in the search language (or an appropriate fallback).

The matched text and language are wrapped using the wikibase-itemlink-userlang-wrapper message. If the matched term has the same text as the display label, an empty string is returned.

Parameters
Term | null$match
Term | null$label
Returns
string HTML

◆ getResultHtml()

Wikibase\Repo\ItemDisambiguation::getResultHtml ( TermSearchResult  $searchResult)
Parameters
TermSearchResult$searchResult
Returns
string HTML

Member Data Documentation

◆ $displayLanguageCode

Wikibase\Repo\ItemDisambiguation::$displayLanguageCode
private

◆ $languageNameLookup

Wikibase\Repo\ItemDisambiguation::$languageNameLookup
private

◆ $titleLookup

Wikibase\Repo\ItemDisambiguation::$titleLookup
private

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