function EntityBase::label

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::label()
  2. 10 core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::label()
  3. 8.9.x core/lib/Drupal/Core/Entity/EntityBase.php \Drupal\Core\Entity\EntityBase::label()
2 calls to EntityBase::label()
ConfigurableLanguage::getName in core/modules/language/src/Entity/ConfigurableLanguage.php
Gets the name of the language.
FieldStorageConfig::getLabel in core/modules/field/src/Entity/FieldStorageConfig.php
Returns the human-readable label for the field.
1 method overrides EntityBase::label()
LayoutBuilderEntityViewDisplay::label in core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
@todo Move this upstream in https://www.drupal.org/node/2939931.

File

core/lib/Drupal/Core/Entity/EntityBase.php, line 150

Class

EntityBase
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

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.