Commit c3996ef5 authored by xjm's avatar xjm
Browse files

SA-CORE-2022-004 by samuel.mortenson, xjm, nod_, effulgentsia, phenaproxima,...

SA-CORE-2022-004 by samuel.mortenson, xjm, nod_, effulgentsia, phenaproxima, mcdruid, Wim Leers, tedbow, longwave, dww, larowlan, pandaski
parent 7401e2ad
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
use Drupal\Component\Plugin\PluginManagerInterface; use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\quickedit\Access\QuickEditEntityFieldAccessCheckInterface; use Drupal\quickedit\Access\QuickEditEntityFieldAccessCheckInterface;
use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\Core\Entity\Entity\EntityViewDisplay;
...@@ -55,7 +56,10 @@ public function __construct(QuickEditEntityFieldAccessCheckInterface $access_che ...@@ -55,7 +56,10 @@ public function __construct(QuickEditEntityFieldAccessCheckInterface $access_che
*/ */
public function generateEntityMetadata(EntityInterface $entity) { public function generateEntityMetadata(EntityInterface $entity) {
return [ return [
'label' => $entity->label(), 'label' => $entity->access('view label') ? $entity->label() : new TranslatableMarkup('@label @id', [
'@label' => $entity->getEntityType()->getSingularLabel(),
'@id' => $entity->id()
])
]; ];
} }
......
Supports Markdown
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