8.2.x EntityTypeInterface.php public EntityTypeInterface::getLabelCallback()
8.0.x EntityTypeInterface.php public EntityTypeInterface::getLabelCallback()
8.1.x EntityTypeInterface.php public EntityTypeInterface::getLabelCallback()
8.3.x EntityTypeInterface.php public EntityTypeInterface::getLabelCallback()

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.

@todo Remove usages of label_callback https://www.drupal.org/node/2450793.

Return value

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

Deprecated

in Drupal 8.0.x-dev and will be removed before Drupal 9.0.0. Use Drupal\Core\Entity\EntityInterface::label() for complex label generation as needed.

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 493

Class

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

Namespace

Drupal\Core\Entity

Code

public function getLabelCallback();