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, User $user, EntityDocument $entity, array $termsLanguages, LanguageDirectionalityLookup $languageDirectionalityLookup, LanguageNameLookup $languageNameLookup, LocalizedTextProvider $textProvider, $cookiePrefix, 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 ( $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
 
 $user
 
 $entity
 
 $termsLanguages
 
 $languageDirectionalityLookup
 
 $languageNameLookup
 
 $textProvider
 
 $cookiePrefix
 
 $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,
User  $user,
EntityDocument  $entity,
array  $termsLanguages,
LanguageDirectionalityLookup  $languageDirectionalityLookup,
LanguageNameLookup  $languageNameLookup,
LocalizedTextProvider  $textProvider,
  $cookiePrefix,
array  $termsListItems = [] 
)
Parameters
TemplateFactory$templateFactory
User$userthe current user
EntityDocument$entity
string[]$termsLanguages
LanguageDirectionalityLookup$languageDirectionalityLookup
LanguageNameLookup$languageNameLookup
LocalizedTextProvider$textProvider
string$cookiePrefix
string[]$termsListItems

Member Function Documentation

◆ expandPlaceholder()

Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::expandPlaceholder (   $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.
Parameters
string$name
Returns
string

◆ 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

◆ $cookiePrefix

Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::$cookiePrefix
private

◆ $entity

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

◆ $languageDirectionalityLookup

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

◆ $languageNameLookup

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

◆ $templateFactory

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

◆ $termsLanguages

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

◆ $termsListItems

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

◆ $textProvider

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

◆ $user

Wikibase\Repo\ParserOutput\PlaceholderExpander\EntityViewPlaceholderExpander::$user
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: