function ContentEntityBase::label
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::label()
- 10 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::label()
- 11.x core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::label()
Overrides EntityBase::label
1 call to ContentEntityBase::label()
- Term::getName in core/
modules/ taxonomy/ src/ Entity/ Term.php - Gets the term name.
6 methods override ContentEntityBase::label()
- EntityTestNoLabel::label in core/
modules/ system/ tests/ modules/ entity_test/ src/ Entity/ EntityTestNoLabel.php - Gets the label of the entity.
- Feed::label in core/
modules/ aggregator/ src/ Entity/ Feed.php - Gets the label of the entity.
- Item::label in core/
modules/ aggregator/ src/ Entity/ Item.php - Gets the label of the entity.
- Media::label in core/
modules/ media/ src/ Entity/ Media.php - Gets the label of the entity.
- PathAlias::label in core/
modules/ path_alias/ src/ Entity/ PathAlias.php - Gets the label of the entity.
File
-
core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php, line 1246
Class
- ContentEntityBase
- Implements Entity Field API specific enhancements to the Entity class.
Namespace
Drupal\Core\EntityCode
public function label() {
$label = NULL;
$entity_type = $this->getEntityType();
if (($label_callback = $entity_type->get('label_callback')) && is_callable($label_callback)) {
@trigger_error('Entity type ' . $this->getEntityTypeId() . ' defines a label callback. Support for that is deprecated in drupal:8.0.0 and will be removed in drupal:9.0.0. Override the EntityInterface::label() method instead. See https://www.drupal.org/node/3050794', E_USER_DEPRECATED);
$label = call_user_func($label_callback, $this);
}
elseif ($label_key = $entity_type->getKey('label')) {
$label = $this->getEntityKey('label');
}
return $label;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.