Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Formatters\CommonsInlineImageFormatter Class Reference

Formats the StringValue from a "commonsMedia" snak as a HTML thumbnail and a link to commons. More...

+ Inheritance diagram for Wikibase\Lib\Formatters\CommonsInlineImageFormatter:
+ Collaboration diagram for Wikibase\Lib\Formatters\CommonsInlineImageFormatter:

Public Member Functions

 __construct (ParserOptions $parserOptions, array $thumbLimits, FormatterOptions $options=null, RepoGroup $repoGroup=null)
 
 format ( $value)
 

Public Attributes

const FALLBACK_THUMBNAIL_WIDTH = 320
 

Private Member Functions

 getThumbWidth ( $thumbSize)
 
 wrapThumb (Title $title, $thumbHtml)
 
 getCaptionHtml (Title $title, $file=null)
 
 getFileMetaHtml (File $file)
 

Private Attributes

 $language
 
 $repoGroup
 
 $parserOptions
 
 $thumbLimits
 

Detailed Description

Formats the StringValue from a "commonsMedia" snak as a HTML thumbnail and a link to commons.

Author
Adrian Heine
Marius Hoch

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Formatters\CommonsInlineImageFormatter::__construct ( ParserOptions  $parserOptions,
array  $thumbLimits,
FormatterOptions  $options = null,
RepoGroup  $repoGroup = null 
)
Parameters
ParserOptions$parserOptionsOptions for thumbnail size
array$thumbLimitsMapping of thumb number to the limit like [ 0 => 120, 1 => 240, ...]
FormatterOptions | null$options
RepoGroup | null$repoGroup
Exceptions

MWException

Member Function Documentation

◆ format()

Wikibase\Lib\Formatters\CommonsInlineImageFormatter::format (   $value)
See also
ValueFormatter::format

Formats the given commons file name as an HTML image gallery.

Parameters
StringValue$valueThe commons file name
Exceptions
InvalidArgumentException
Returns
string HTML

◆ getCaptionHtml()

Wikibase\Lib\Formatters\CommonsInlineImageFormatter::getCaptionHtml ( Title  $title,
  $file = null 
)
private
Parameters
Title$title
File | null$file
Returns
string HTML

◆ getFileMetaHtml()

Wikibase\Lib\Formatters\CommonsInlineImageFormatter::getFileMetaHtml ( File  $file)
private
Parameters
File$file
Returns
string HTML

◆ getThumbWidth()

Wikibase\Lib\Formatters\CommonsInlineImageFormatter::getThumbWidth (   $thumbSize)
private

◆ wrapThumb()

Wikibase\Lib\Formatters\CommonsInlineImageFormatter::wrapThumb ( Title  $title,
  $thumbHtml 
)
private
Parameters
Title$title
string$thumbHtml
Returns
string HTML

Member Data Documentation

◆ $language

Wikibase\Lib\Formatters\CommonsInlineImageFormatter::$language
private

◆ $parserOptions

Wikibase\Lib\Formatters\CommonsInlineImageFormatter::$parserOptions
private

◆ $repoGroup

Wikibase\Lib\Formatters\CommonsInlineImageFormatter::$repoGroup
private

◆ $thumbLimits

Wikibase\Lib\Formatters\CommonsInlineImageFormatter::$thumbLimits
private

◆ FALLBACK_THUMBNAIL_WIDTH

const Wikibase\Lib\Formatters\CommonsInlineImageFormatter::FALLBACK_THUMBNAIL_WIDTH = 320

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