diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 16b437a..60435a6 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -934,6 +934,21 @@ public function __clone() { /** * {@inheritdoc} */ + public function label() { + $label = NULL; + $entity_info = $this->entityInfo(); + if (isset($entity_info['label_callback']) && function_exists($entity_info['label_callback'])) { + $label = $entity_info['label_callback']($this->entityType, $this); + } + elseif (!empty($entity_info['entity_keys']['label']) && isset($this->{$entity_info['entity_keys']['label']})) { + $label = $this->{$entity_info['entity_keys']['label']}->value; + } + return $label; + } + + /** + * {@inheritdoc} + */ public function referencedEntities() { $referenced_entities = array();