You are here

public function EntityTypeInterface::getLabelCallback in Drupal 8

Gets the callback for the label of the entity.

The function takes an entity and returns the label of the entity. Use language() on the entity to get information on the requested language. The entity label is the main string associated with an entity; for example, the title of a node or the subject of a comment. If there is an entity object property that defines the label, use the 'label' element of the 'entity_keys' return value component to provide this information. If more complex logic is needed to determine the label of an entity, you can instead specify a callback function here, which will be called to determine the entity label.

Return value

callable|null The callback, or NULL if none exists.

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Override the EntityInterface::label() method instead for dynamic labels.

See also

\Drupal\Core\Entity\EntityInterface::label()

\Drupal\Core\Entity\EntityTypeInterface::setLabelCallback()

\Drupal\Core\Entity\EntityTypeInterface::hasLabelCallback()

1 method overrides EntityTypeInterface::getLabelCallback()
EntityType::getLabelCallback in core/lib/Drupal/Core/Entity/EntityType.php
Gets the callback for the label of the entity.

File

core/lib/Drupal/Core/Entity/EntityTypeInterface.php, line 505

Class

EntityTypeInterface
Provides an interface for an entity type and its metadata.

Namespace

Drupal\Core\Entity

Code

public function getLabelCallback();