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

Formatter for rendering the details of a QuantityValue (most useful for diffs) in HTML. More...

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

Public Member Functions

 __construct (?NumberLocalizer $numberLocalizer, ValueFormatter $vocabularyUriFormatter, FormatterOptions $options=null)
 
 format ( $value)
 

Private Member Functions

 formatNumber (DecimalValue $number, $unit)
 
 formatUnit ( $unit)
 
 renderLabelValuePair ( $fieldName, $valueHtml)
 
 getFieldLabel ( $fieldName)
 

Private Attributes

 $quantityFormatter
 
 $numberFormatter
 
 $vocabularyUriFormatter
 
 $options
 

Detailed Description

Formatter for rendering the details of a QuantityValue (most useful for diffs) in HTML.

Author
Daniel Kinzler
Thiemo Kreuz

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Formatters\QuantityDetailsFormatter::__construct ( ?NumberLocalizer $numberLocalizer,
ValueFormatter $vocabularyUriFormatter,
FormatterOptions $options = null )
Parameters
NumberLocalizer | null$numberLocalizer
ValueFormatter$vocabularyUriFormatter
FormatterOptions | null$options

Member Function Documentation

◆ format()

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

Generates HTML representing the details of a QuantityValue, as an itemized list.

Parameters
UnboundedQuantityValue | QuantityValue$value
Exceptions
InvalidArgumentException
Returns
string HTML
Todo
Display URIs to entities in the local repository as clickable labels.
Todo
Todo
Display URIs that start with http:// or https:// as clickable links.
Todo
Todo
Mark "unitless" units somehow, e.g. via CSS or with an appended message.
See also
WikibaseValueFormatterBuilders::$unitOneUris

◆ formatNumber()

Wikibase\Lib\Formatters\QuantityDetailsFormatter::formatNumber ( DecimalValue $number,
$unit )
private
Parameters
DecimalValue$number
string$unitURI
Returns
string HTML

◆ formatUnit()

Wikibase\Lib\Formatters\QuantityDetailsFormatter::formatUnit ( $unit)
private
Parameters
string$unitURI
Returns
string HTML

◆ getFieldLabel()

Wikibase\Lib\Formatters\QuantityDetailsFormatter::getFieldLabel ( $fieldName)
private
Parameters
string$fieldName
Returns
Message

◆ renderLabelValuePair()

Wikibase\Lib\Formatters\QuantityDetailsFormatter::renderLabelValuePair ( $fieldName,
$valueHtml )
private
Parameters
string$fieldName
string$valueHtmlHTML
Returns
string HTML for the label/value pair

Member Data Documentation

◆ $numberFormatter

Wikibase\Lib\Formatters\QuantityDetailsFormatter::$numberFormatter
private

◆ $options

Wikibase\Lib\Formatters\QuantityDetailsFormatter::$options
private

◆ $quantityFormatter

Wikibase\Lib\Formatters\QuantityDetailsFormatter::$quantityFormatter
private

◆ $vocabularyUriFormatter

Wikibase\Lib\Formatters\QuantityDetailsFormatter::$vocabularyUriFormatter
private

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