From 0ea69dc824f56f1cbeb38103e3fa4718832cc109 Mon Sep 17 00:00:00 2001
From: xjm <xjm@65776.no-reply.drupal.org>
Date: Tue, 15 Feb 2022 14:26:24 -0600
Subject: [PATCH] SA-CORE-2022-004 by samuel.mortenson, xjm, nod_,
 effulgentsia, phenaproxima, mcdruid, Wim Leers, tedbow, longwave, dww,
 larowlan, pandaski

---
 core/modules/quickedit/src/MetadataGenerator.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/core/modules/quickedit/src/MetadataGenerator.php b/core/modules/quickedit/src/MetadataGenerator.php
index 174726fe1329..a071512b5d61 100644
--- a/core/modules/quickedit/src/MetadataGenerator.php
+++ b/core/modules/quickedit/src/MetadataGenerator.php
@@ -5,6 +5,7 @@
 use Drupal\Component\Plugin\PluginManagerInterface;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\StringTranslation\TranslatableMarkup;
 use Drupal\quickedit\Access\QuickEditEntityFieldAccessCheckInterface;
 use Drupal\Core\Entity\Entity\EntityViewDisplay;
 
@@ -55,7 +56,10 @@ public function __construct(QuickEditEntityFieldAccessCheckInterface $access_che
    */
   public function generateEntityMetadata(EntityInterface $entity) {
     return [
-      'label' => $entity->label(),
+      'label' => $entity->access('view label') ? $entity->label() : new TranslatableMarkup('@label @id', [
+        '@label' => $entity->getEntityType()->getSingularLabel(),
+        '@id' => $entity->id()
+      ])
     ];
   }
 
-- 
GitLab