public function Entity::label

Implements \Drupal\Core\Entity\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 \Drupal\Core\Entity\EntityInterface::createDuplicate().
4 methods override Entity::label()
Block::label in drupal/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php
Overrides \Drupal\Core\Entity\Entity::label();
Editor::label in drupal/core/modules/editor/lib/Drupal/editor/Plugin/Core/Entity/Editor.php
Overrides Drupal\Core\Entity\Entity::label().
EntityNG::label in drupal/core/lib/Drupal/Core/Entity/EntityNG.php
Overrides Entity::label() to access the label field with the new API.
View::label in drupal/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php
Overrides \Drupal\Core\Entity\Entity::label().

File

drupal/core/lib/Drupal/Core/Entity/Entity.php, line 139
Contains \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;
}