ContentEntityBase::label

public ContentEntityBase::label()

Gets the label of the entity.

Return value

string|null The label of the entity, or NULL if there is no label defined.

Overrides Entity::label

File

core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 1046

Class

ContentEntityBase
Implements Entity Field API specific enhancements to the Entity class.

Namespace

Drupal\Core\Entity

Code

public function label() {
  $label = NULL;
  $entity_type = $this->getEntityType();
  if (($label_callback = $entity_type->getLabelCallback()) && is_callable($label_callback)) {
    $label = call_user_func($label_callback, $this);
  }
  elseif (($label_key = $entity_type->getKey('label'))) {
    $label = $this->getEntityKey('label');
  }
  return $label;
}
doc_Drupal
2016-10-29 08:56:59
Comments
Leave a Comment

Please login to continue.