1 entity.class.inc | public Entity::label() |
Implements EntityInterface::label().
Return value
string|null: The label of the entity, or NULL if there is no label defined.
Overrides EntityInterface::label
File
- core/
modules/ entity/ entity.class.inc, line 287 - Provides an interface and a base class for entities.
Class
- Entity
- Defines a base entity class.
Code
public function label() {
$entity_info = entity_get_info($this->entityType());
$label = NULL;
if (isset($entity_info['label callback'])) {
$label = call_user_func($entity_info['label callback'], $this);
}
else if (isset($entity_info['entity keys']['label'])) {
$label = $this->{$entity_info['entity keys']['label']};
}
return $label;
}