SA-CORE-2022-004 by samuel.mortenson, xjm, nod_, effulgentsia, phenaproxima, mcdruid, Wim Leers, tedbow, longwave, dww, larowlan, pandaski

merge-requests/1247/head
xjm 2022-02-15 14:26:31 -06:00
parent 7401e2ade3
commit c3996ef56c
1 changed files with 5 additions and 1 deletions

View File

@ -5,6 +5,7 @@ namespace Drupal\quickedit;
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 @@ class MetadataGenerator implements MetadataGeneratorInterface {
*/
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()
])
];
}