public function Entity::label

Implements EntityInterface::label().

Overrides EntityInterface::label

1 call to Entity::label()
PictureMapping::createDuplicate in drupal/core/modules/picture/lib/Drupal/picture/Plugin/Core/Entity/PictureMapping.php
Implements EntityInterface::createDuplicate().
1 method overrides Entity::label()
EntityTest::label in drupal/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTest.php
Overrides Drupal\entity\Entity::label().

File

drupal/core/lib/Drupal/Core/Entity/Entity.php, line 136
Definition of Drupal\Core\Entity\Entity.

Class

Entity
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public function label($langcode = NULL) {
  $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, $langcode);
  }
  elseif (!empty($entity_info['entity_keys']['label']) && isset($this->{$entity_info['entity_keys']['label']})) {
    $label = $this->{$entity_info['entity_keys']['label']};
  }
  return $label;
}