function eck__entity__label in Entity Construction Kit (ECK) 7.3
Same name and namespace in other branches
- 7 eck.module \eck__entity__label()
- 7.2 eck.module \eck__entity__label()
Entity label callback.
This is the callback function for an entities label By default the label is the id of the entity, but a number of hooks are defined to customize the label if needed
Parameters
object $entity: an object as returned by entity_load().
1 string reference to 'eck__entity__label'
- eck__entity_type__info in ./
eck.entity_type.inc - Generate the entity info for a specific entity.
File
- ./
eck.module, line 162
Code
function eck__entity__label($entity) {
$hook_names = array(
"eck_entity_label",
"eck_entity_{$entity->entityType()}_label",
"eck_entity_{$entity->entityType()}_{$entity->bundle()}_label",
);
foreach ($hook_names as $hook_name) {
$new_label = module_invoke_all($hook_name, $entity, $entity->id);
$empty = empty($new_label);
if (!$empty) {
break;
}
}
if (!$empty) {
return $new_label[0];
}
else {
return $entity->id;
}
}