function callback_entity_info_label

callback_entity_info_label($entity, $entity_type)

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 4871
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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.api.php/function/callback_entity_info_label/7.x