function eck__entity__label in Entity Construction Kit (ECK) 7
Same name and namespace in other branches
- 7.3 eck.module \eck__entity__label()
- 7.2 eck.module \eck__entity__label()
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
$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 436 - ENTITY CONSTRUCTION KIT
Code
function eck__entity__label($entity) {
$hook_names = array(
"entity_label",
"entity_{$entity->entityType()}_label",
"entity_{$entity->entityType()}_{$entity->type}_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;
}
}