EntityType::getLabelCallback

public EntityType::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.

Overrides EntityTypeInterface::getLabelCallback

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()

File

core/lib/Drupal/Core/Entity/EntityType.php, line 645

Class

EntityType
Provides an implementation of an entity type and its metadata.

Namespace

Drupal\Core\Entity

Code

public function getLabelCallback() {
  return $this->label_callback;
}
doc_Drupal
2016-10-29 09:08:00
Comments
Leave a Comment

Please login to continue.