Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander Class Reference

Utility for expanding placeholders left in the HTML. More...

+ Inheritance diagram for Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander:
+ Collaboration diagram for Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander:

Public Member Functions

 __construct (TemplateFactory $templateFactory, UserIdentity $user, EntityDocument $entity, array $termsLanguages, LanguageDirectionalityLookup $languageDirectionalityLookup, LanguageNameLookup $languageNameLookup, LocalizedTextProvider $textProvider, UserOptionsLookup $userOptionsLookup, LanguageFallbackChainFactory $languageFallbackChainFactory, bool $mulEnabled, array $termsListItems=[])
 
 getHtmlForPlaceholder ( $name)
 Callback for expanding placeholders to HTML, for use as a callback passed to with TextInjector::inject().
 

Public Attributes

const INITIALLY_COLLAPSED_SETTING_NAME = 'wikibase-entitytermsview-showEntitytermslistview'
 

Private Member Functions

 expandPlaceholder (string $name)
 Dispatch the expansion of placeholders based on the name.
 
 isInitiallyCollapsed ()
 
 renderTermBox ()
 Generates HTML of the term box, to be injected into the entity page.
 

Private Attributes

TemplateFactory $templateFactory
 
UserIdentity $user
 
EntityDocument $entity
 
LanguageDirectionalityLookup $languageDirectionalityLookup
 
LanguageNameLookup $languageNameLookup
 
LocalizedTextProvider $textProvider
 
UserOptionsLookup $userOptionsLookup
 
LanguageFallbackChainFactory $languageFallbackChainFactory
 
bool $mulEnabled
 
array $termsLanguages
 
array $termsListItems
 

Detailed Description

Utility for expanding placeholders left in the HTML.

This is used to inject any non-cacheable information into the HTML that was cached as part of the ParserOutput.

Author
Daniel Kinzler
Adrian Heine adria.nosp@m.n.he.nosp@m.ine@w.nosp@m.ikim.nosp@m.edia..nosp@m.de

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::__construct ( TemplateFactory $templateFactory,
UserIdentity $user,
EntityDocument $entity,
array $termsLanguages,
LanguageDirectionalityLookup $languageDirectionalityLookup,
LanguageNameLookup $languageNameLookup,
LocalizedTextProvider $textProvider,
UserOptionsLookup $userOptionsLookup,
LanguageFallbackChainFactory $languageFallbackChainFactory,
bool $mulEnabled,
array $termsListItems = [] )
Parameters
TemplateFactory$templateFactory
UserIdentity$userthe current user
EntityDocument$entity
string[]$termsLanguages
LanguageDirectionalityLookup$languageDirectionalityLookup
LanguageNameLookup$languageNameLookup
LocalizedTextProvider$textProvider
UserOptionsLookup$userOptionsLookup
LanguageFallbackChainFactory$languageFallbackChainFactory
bool$mulEnabled
string[]$termsListItems

Member Function Documentation

◆ expandPlaceholder()

Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::expandPlaceholder ( string $name)
private

Dispatch the expansion of placeholders based on the name.

Note
This encodes knowledge about which placeholders are used by EntityView with what intended meaning.

◆ getHtmlForPlaceholder()

Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::getHtmlForPlaceholder ( $name)

Callback for expanding placeholders to HTML, for use as a callback passed to with TextInjector::inject().

Note
This delegates to expandPlaceholder, which encapsulates knowledge about the meaning of each placeholder name, as used by EntityView.
Parameters
string$namethe name (or kind) of placeholder; determines how the expansion is done.
Returns
string HTML to be substituted for the placeholder in the output.

Implements Wikibase\Repo\ParserOutput\PlaceholderExpander\PlaceholderExpander.

◆ isInitiallyCollapsed()

Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::isInitiallyCollapsed ( )
private
Returns
bool If the terms list should be initially collapsed for the current user.

◆ renderTermBox()

Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::renderTermBox ( )
private

Generates HTML of the term box, to be injected into the entity page.

Exceptions
InvalidArgumentException
Returns
string HTML

Member Data Documentation

◆ $entity

EntityDocument Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::$entity
private

◆ $languageDirectionalityLookup

LanguageDirectionalityLookup Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::$languageDirectionalityLookup
private

◆ $languageFallbackChainFactory

LanguageFallbackChainFactory Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::$languageFallbackChainFactory
private

◆ $languageNameLookup

LanguageNameLookup Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::$languageNameLookup
private

◆ $mulEnabled

bool Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::$mulEnabled
private

◆ $templateFactory

TemplateFactory Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::$templateFactory
private

◆ $termsLanguages

array Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::$termsLanguages
private

◆ $termsListItems

array Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::$termsListItems
private

◆ $textProvider

LocalizedTextProvider Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::$textProvider
private

◆ $user

UserIdentity Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::$user
private

◆ $userOptionsLookup

UserOptionsLookup Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::$userOptionsLookup
private

◆ INITIALLY_COLLAPSED_SETTING_NAME

const Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::INITIALLY_COLLAPSED_SETTING_NAME = 'wikibase-entitytermsview-showEntitytermslistview'

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