time.html.twig
Same filename in this branch
Same filename in other branches
- 9 core/profiles/demo_umami/themes/umami/templates/classy/field/time.html.twig
- 9 core/themes/stable9/templates/field/time.html.twig
- 9 core/themes/seven/templates/classy/field/time.html.twig
- 9 core/themes/claro/templates/classy/field/time.html.twig
- 9 core/themes/bartik/templates/classy/field/time.html.twig
- 9 core/themes/stable/templates/field/time.html.twig
- 9 core/themes/starterkit_theme/templates/field/time.html.twig
- 9 core/themes/classy/templates/field/time.html.twig
- 9 core/modules/system/templates/time.html.twig
- 8.9.x core/profiles/demo_umami/themes/umami/templates/classy/field/time.html.twig
- 8.9.x core/themes/seven/templates/classy/field/time.html.twig
- 8.9.x core/themes/claro/templates/classy/field/time.html.twig
- 8.9.x core/themes/bartik/templates/classy/field/time.html.twig
- 8.9.x core/themes/stable/templates/field/time.html.twig
- 8.9.x core/themes/classy/templates/field/time.html.twig
- 8.9.x core/modules/system/templates/time.html.twig
- 11.x core/profiles/demo_umami/themes/umami/templates/classy/field/time.html.twig
- 11.x core/themes/stable9/templates/field/time.html.twig
- 11.x core/themes/claro/templates/classy/field/time.html.twig
- 11.x core/themes/starterkit_theme/templates/field/time.html.twig
- 11.x core/modules/system/templates/time.html.twig
Theme override for a date / time element.
Available variables
- timestamp: (optional) A UNIX timestamp for the datetime attribute. If the datetime cannot be represented as a UNIX timestamp, use a valid datetime attribute value in attributes.datetime.
- text: (optional) The content to display within the <time> element. Defaults to a human-readable representation of the timestamp value or the datetime attribute value using DateFormatter::format().
- attributes: (optional) HTML attributes to apply to the <time> element. A datetime attribute in 'attributes' overrides the 'timestamp'. To create a valid datetime attribute value from a UNIX timestamp, use DateFormatter::format() with one of the predefined 'html_*' formats.
See also
http://www.w3.org/TR/html5-author/the-time-element.html#attr-time-datet…
2 theme calls to time.html.twig
- DateTimeFormatterBase::buildDateWithIsoAttribute in core/
modules/ datetime/ src/ Plugin/ Field/ FieldFormatter/ DateTimeFormatterBase.php - Creates a render array from a date object with ISO date attribute.
- TimestampFormatter::viewElements in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ TimestampFormatter.php - Builds a renderable array for a field value.
File
-
core/
themes/ starterkit_theme/ templates/ field/ time.html.twig
View source
- {#
- /**
- * @file
- * Theme override for a date / time element.
- *
- * Available variables
- * - timestamp: (optional) A UNIX timestamp for the datetime attribute. If the
- * datetime cannot be represented as a UNIX timestamp, use a valid datetime
- * attribute value in attributes.datetime.
- * - text: (optional) The content to display within the <time> element.
- * Defaults to a human-readable representation of the timestamp value or the
- * datetime attribute value using DateFormatter::format().
- * - attributes: (optional) HTML attributes to apply to the <time> element.
- * A datetime attribute in 'attributes' overrides the 'timestamp'. To
- * create a valid datetime attribute value from a UNIX timestamp, use
- * DateFormatter::format() with one of the predefined 'html_*' formats.
- *
- * @see template_preprocess_time()
- * @see http://www.w3.org/TR/html5-author/the-time-element.html#attr-time-datetime
- */
- #}
- <time{{ attributes.addClass('datetime') }}>{{ text }}</time>
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.