Commit 405f1380 authored by xjm's avatar xjm

Issue #2500747 by joelpittet, effulgentsia: Remove 'html' option from theme('time')

parent faec539a
......@@ -445,12 +445,10 @@ function template_preprocess_time(&$variables) {
// Format and use a human-readable version of the timestamp, if any.
if (isset($variables['timestamp'])) {
$variables['text'] = format_date($variables['timestamp']);
$variables['html'] = FALSE;
}
// Otherwise, use the literal datetime attribute.
elseif (isset($variables['attributes']['datetime'])) {
$variables['text'] = $variables['attributes']['datetime'];
$variables['html'] = FALSE;
}
}
}
......@@ -1729,7 +1727,7 @@ function drupal_common_theme() {
'render element' => 'elements',
),
'time' => array(
'variables' => array('timestamp' => NULL, 'text' => NULL, 'attributes' => array(), 'html' => FALSE),
'variables' => array('timestamp' => NULL, 'text' => NULL, 'attributes' => array()),
),
'datetime_form' => array(
'render element' => 'element',
......
......@@ -134,7 +134,6 @@ public function viewElements(FieldItemListInterface $items) {
],
'#theme' => 'time',
'#text' => $formatted_date,
'#html' => FALSE,
'#attributes' => array(
'datetime' => $iso_date,
),
......
......@@ -7,22 +7,16 @@
* - 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. Set
* 'html' to TRUE if this value is already sanitized for output in HTML.
* - 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 format_date().
* - 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
* format_date() with one of the predefined 'html_*' formats.
* - html: (optional) Whether 'text' is HTML markup (TRUE) or plain-text
* (FALSE). Defaults to FALSE. For example, to use a SPAN tag within the
* TIME element, this must be set to TRUE, or the SPAN tag will be escaped.
* It is the responsibility of the caller to properly sanitize the value
* contained in 'text' (or within the SPAN tag in aforementioned example).
*
* @see template_preprocess_datetime()
* @see template_preprocess_time()
* @see http://www.w3.org/TR/html5-author/the-time-element.html#attr-time-datetime
*/
#}
<time{{ attributes }}>{{ html ? text|raw : text }}</time>
<time{{ attributes }}>{{ text }}</time>
......@@ -7,22 +7,16 @@
* - 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. Set
* 'html' to TRUE if this value is already sanitized for output in HTML.
* - 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 format_date().
* - 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
* format_date() with one of the predefined 'html_*' formats.
* - html: (optional) Whether 'text' is HTML markup (TRUE) or plain-text
* (FALSE). Defaults to FALSE. For example, to use a SPAN tag within the
* TIME element, this must be set to TRUE, or the SPAN tag will be escaped.
* It is the responsibility of the caller to properly sanitize the value
* contained in 'text' (or within the SPAN tag in aforementioned example).
*
* @see template_preprocess_datetime()
* @see template_preprocess_time()
* @see http://www.w3.org/TR/html5-author/the-time-element.html#attr-time-datetime
*/
#}
<time{{ attributes.addClass('datetime') }}>{{ html ? text|raw : text }}</time>
<time{{ attributes.addClass('datetime') }}>{{ text }}</time>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment