function farm_log_entity_view in farmOS 7
Implements hook_entity_view().
File
- modules/
farm/ farm_log/ farm_log.module, line 13 - Code for the Farm Log feature.
Code
function farm_log_entity_view($entity, $type, $view_mode, $langcode) {
// If the entity is not a log, bail.
if ($type != 'log') {
return;
}
// Add the log type.
$log_types = log_type_get_names();
if (!empty($log_types[$entity->type])) {
$entity->content['type'] = array(
'#markup' => '<div><strong>Log type:</strong> ' . $log_types[$entity->type] . '</div>',
'#weight' => -102,
);
}
// Add the log ID.
if (!empty($entity->id)) {
$entity->content['id'] = array(
'#markup' => '<div><strong>Log ID:</strong> ' . $entity->id . '</div>',
'#weight' => -101,
);
}
}