Return the label of an entity.

Callback for hook_entity_info().

Parameters

$entity: The entity for which to generate the label.

$entity_type: The entity type; e.g., 'node' or 'user'.

Return value

An unsanitized string with the label of the entity.

See also

entity_label()

Related topics

File

modules/system/system.api.php, line 4914
Hooks provided by Drupal core and the System module.

Code

function callback_entity_info_label($entity, $entity_type) {
  return empty($entity->title) ? 'Untitled entity' : $entity->title;
}