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

A value formatter that creates a basic, single-line HTML representation of a TimeValue's date, time and calendar model. More...

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

Public Member Functions

 __construct (?FormatterOptions $options, ValueFormatter $dateTimeFormatter, ShowCalendarModelDecider $decider)
 
 format ( $value)
 

Private Member Functions

 formatCalendarName ( $calendarModel)
 

Private Attributes

const CALENDAR_KEYS
 
 $dateTimeFormatter
 
 $options
 
ShowCalendarModelDecider $decider
 

Detailed Description

A value formatter that creates a basic, single-line HTML representation of a TimeValue's date, time and calendar model.

The calendar model is added in superscript when needed, as determined by the ShowCalendarModelDecider (taking the options into account).

See also
\Wikibase\Lib\Formatters\TimeDetailsFormatter
Author
Adrian Heine adria.nosp@m.n.he.nosp@m.ine@w.nosp@m.ikim.nosp@m.edia..nosp@m.de
Thiemo Kreuz
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Formatters\HtmlTimeFormatter::__construct ( ?FormatterOptions $options,
ValueFormatter $dateTimeFormatter,
ShowCalendarModelDecider $decider )
Parameters
FormatterOptions | null$options
ValueFormatter$dateTimeFormatterA value formatter that accepts TimeValue objects and returns the formatted date and time, but not the calendar model. The formatter is assumed to return plain text (its output will be HTML-escaped).
ShowCalendarModelDecider$decider

Member Function Documentation

◆ format()

Wikibase\Lib\Formatters\HtmlTimeFormatter::format ( $value)
See also
ValueFormatter::format
Parameters
TimeValue$value
Exceptions
InvalidArgumentException
Returns
string HTML

◆ formatCalendarName()

Wikibase\Lib\Formatters\HtmlTimeFormatter::formatCalendarName ( $calendarModel)
private
Parameters
string$calendarModel
Returns
string HTML

Member Data Documentation

◆ $dateTimeFormatter

Wikibase\Lib\Formatters\HtmlTimeFormatter::$dateTimeFormatter
private

◆ $decider

ShowCalendarModelDecider Wikibase\Lib\Formatters\HtmlTimeFormatter::$decider
private

◆ $options

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

◆ CALENDAR_KEYS

const Wikibase\Lib\Formatters\HtmlTimeFormatter::CALENDAR_KEYS
private
Initial value:
= [
TimeValue::CALENDAR_GREGORIAN => 'wikibase-time-calendar-gregorian',
TimeValue::CALENDAR_JULIAN => 'wikibase-time-calendar-julian',
]

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