diff --git a/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php b/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php index 500d780..3673869 100644 --- a/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php +++ b/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php @@ -100,8 +100,14 @@ public function render(ResultRow $values) { $build = array( '#theme' => 'mark', '#status' => $mark, + '#access' => ($mark == MARK_NEW || $mark == MARK_UPDATED), + '#cache' => [ + 'contexts' [ + 'user.permissions' + ], + ], ); - return $this->renderLink(drupal_render($build), $values); + return $this->renderLink(\Drupal::service('renderer')->render($build), $values); } } diff --git a/core/modules/node/src/NodeListBuilder.php b/core/modules/node/src/NodeListBuilder.php index 35013f6..4a8bc9b 100644 --- a/core/modules/node/src/NodeListBuilder.php +++ b/core/modules/node/src/NodeListBuilder.php @@ -105,7 +105,8 @@ public function buildRow(EntityInterface $entity) { /** @var \Drupal\node\NodeInterface $entity */ $mark = array( '#theme' => 'mark', - '#mark_type' => node_mark($entity->id(), $entity->getChangedTime()), + '#status' => node_mark($entity->id(), $entity->getChangedTime()), + '#access' => (\Drupal::currentUser()->isAuthenticated() && ($mark == MARK_NEW || $mark == MARK_UPDATED)), ); $langcode = $entity->language()->getId(); $uri = $entity->urlInfo(); diff --git a/core/modules/system/templates/mark.html.twig b/core/modules/system/templates/mark.html.twig index 58adae1..a2fda18 100644 --- a/core/modules/system/templates/mark.html.twig +++ b/core/modules/system/templates/mark.html.twig @@ -13,10 +13,18 @@ * @ingroup themeable */ #} +{% import _self as mark %} + {% if logged_in %} + {{ mark.text(status) }} +{% endif %} + +{% macro text(status) %} {% if status is constant('MARK_NEW') %} {{ 'New'|t }} {% elseif status is constant('MARK_UPDATED') %} {{ 'Updated'|t }} + {% elseif status is constant('MARK_READ') %} + {{ 'Read'|t }} {% endif %} -{% endif %} +{% endmacro %} diff --git a/core/themes/classy/templates/content/mark.html.twig b/core/themes/classy/templates/content/mark.html.twig index 9219915..64e9668 100644 --- a/core/themes/classy/templates/content/mark.html.twig +++ b/core/themes/classy/templates/content/mark.html.twig @@ -11,10 +11,18 @@ * - MARK_READ */ #} +{% import _self as mark %} + {% if logged_in %} + {{ mark.text(status) }} +{% endif %} + +{% macro text(status) %} {% if status is constant('MARK_NEW') %} - {{ 'New'|t }} + {{ 'New'|t }} {% elseif status is constant('MARK_UPDATED') %} - {{ 'Updated'|t }} + {{ 'Updated'|t }} + {% elseif status is constant('MARK_READ') %} + {{ 'Read'|t }} {% endif %} -{% endif %} +{% endmacro %} diff --git a/core/themes/stable/templates/content/mark.html.twig b/core/themes/stable/templates/content/mark.html.twig index bc70b5c..370bcc4 100644 --- a/core/themes/stable/templates/content/mark.html.twig +++ b/core/themes/stable/templates/content/mark.html.twig @@ -11,10 +11,18 @@ * - MARK_READ */ #} +{% import _self as mark %} + {% if logged_in %} + {{ mark.text(status) }} +{% endif %} + +{% macro text(status) %} {% if status is constant('MARK_NEW') %} {{ 'New'|t }} {% elseif status is constant('MARK_UPDATED') %} {{ 'Updated'|t }} + {% elseif status is constant('MARK_READ') %} + {{ 'Read'|t }} {% endif %} -{% endif %} +{% endmacro %}