8.5.x Entity.php Entity::label()
8.0.x Entity.php Entity::label()
8.1.x Entity.php Entity::label()
8.2.x Entity.php Entity::label()
8.3.x Entity.php Entity::label()
8.4.x Entity.php Entity::label()
8.6.x Entity.php Entity::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 EntityInterface::label

5 calls to Entity::label()
ConfigurableLanguage::getName in core/modules/language/src/Entity/ConfigurableLanguage.php
Gets the name of the language.
Entity::toLink in core/lib/Drupal/Core/Entity/Entity.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.
FieldStorageConfig::getLabel in core/modules/field/src/Entity/FieldStorageConfig.php
Returns the human-readable label for the field.
FilterFormat::preSave in core/modules/filter/src/Entity/FilterFormat.php
Acts on an entity before the presave hook is invoked.
5 methods override Entity::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.
TestSearchPage::label in core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php
Gets the label of the entity.
View::label in core/modules/views/src/Entity/View.php
Gets the label of the entity.


core/lib/Drupal/Core/Entity/Entity.php, line 155


Defines a base entity class.




public function label() {
  $label = NULL;
  $entity_type = $this
  if (($label_callback = $entity_type
    ->getLabelCallback()) && is_callable($label_callback)) {
    $label = call_user_func($label_callback, $this);
  elseif (($label_key = $entity_type
    ->getKey('label')) && isset($this->{$label_key})) {
    $label = $this->{$label_key};
  return $label;