function EntityBase::label
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::label()
- 8.9.x core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::label()
- 11.x core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::label()
Gets the label of the entity.
Return value
string|\Drupal\Core\StringTranslation\TranslatableMarkup|null The label of the entity, or NULL if there is no label defined.
Overrides EntityInterface::label
2 calls to EntityBase::label()
- EntityBase::toLink in core/
lib/ Drupal/ Core/ Entity/ EntityBase.php - Generates the HTML for a link to this entity.
- FieldConfigBase::getLabel in core/
lib/ Drupal/ Core/ Field/ FieldConfigBase.php - Returns a human readable label.
3 methods override EntityBase::label()
- Block::label in core/
modules/ block/ src/ Entity/ Block.php - Gets the label of the entity.
- ContentEntityBase::label in core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php - Gets the label of the entity.
- Editor::label in core/
modules/ editor/ src/ Entity/ Editor.php - Gets the label of the entity.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityBase.php, line 150
Class
- EntityBase
- Defines a base entity class.
Namespace
Drupal\Core\EntityCode
public function label() {
if (($label_key = $this->getEntityType()
->getKey('label')) && isset($this->{$label_key})) {
return $this->{$label_key};
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.