diff --git a/core/includes/theme.inc b/core/includes/theme.inc index a396619..64a05e8 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2215,23 +2215,20 @@ function template_preprocess_tablesort_indicator(&$variables) { } /** - * Returns HTML for a marker for new or updated content. + * Prepares variables for mark templates. * - * @param $variables + * Default template: mark.html.twig. + * + * @param array $variables * An associative array containing: - * - type: Number representing the marker type to display. See MARK_NEW, + * - status: Number representing the marker type to display. See MARK_NEW, * MARK_UPDATED, MARK_READ. */ -function theme_mark($variables) { - $type = $variables['status']; +function template_preprocess_mark(&$variables) { global $user; + $variables['logged_in'] = FALSE; if ($user->uid) { - if ($type == MARK_NEW) { - return ' ' . t('new') . ''; - } - elseif ($type == MARK_UPDATED) { - return ' ' . t('updated') . ''; - } + $variables['logged_in'] = TRUE; } } @@ -3114,6 +3111,7 @@ function drupal_common_theme() { ), 'mark' => array( 'variables' => array('status' => MARK_NEW), + 'template' => 'mark', ), 'item_list' => array( 'variables' => array('items' => array(), 'title' => '', 'list_type' => 'ul', 'attributes' => array()), diff --git a/core/modules/system/templates/mark.html.twig b/core/modules/system/templates/mark.html.twig new file mode 100644 index 0000000..2a83c5b --- /dev/null +++ b/core/modules/system/templates/mark.html.twig @@ -0,0 +1,25 @@ +{# +/** + * @file + * Default theme implementation for a marker for new or updated content. + * + * Available variables: + * - status: Number representing the marker status to display. Use the constants + * below for comparison: + * - MARK_NEW + * - MARK_UPDATED + * - MARK_READ + * - logged_in: A flag indicating whether the user is logged in or not. + * + * @see template_preprocess_mark() + * + * @ingroup themeable + */ +#} +{% if logged_in %} + {% if status is constant('MARK_NEW') %} + {{ 'new'|t }} + {% elseif status is constant('MARK_UPDATED') %} + {{ 'updated'|t }} + {% endif %} +{% endif %}