function log_view in Log entity 7
Log view callback.
Parameters
Log $log: The log entity.
Return value
array Returns the entity render array.
1 string reference to 'log_view'
- log_menu in ./
log.module - Implements hook_menu().
File
- ./
log.pages.inc, line 17 - Log pages.
Code
function log_view(Log $log) {
// Set the title of the page to the log's label.
drupal_set_title(entity_label('log', $log));
// Build the log entity render array.
$output = entity_view('log', array(
entity_id('log', $log) => $log,
), 'full');
// Add the log's "done" status.
if ($log->done) {
$status = 'DONE';
}
else {
$status = 'NOT DONE';
drupal_set_message(t('This log item is not done.'), 'warning');
}
$output['log'][$log->id]['done'] = array(
'#markup' => '<div style="float: right;">Status: <strong>' . $status . '</strong></div>',
'#weight' => -100,
);
// Add the log's timestamp.
if (!empty($log->timestamp)) {
$date = format_date($log->timestamp);
$output['log'][$log->id]['timestamp'] = array(
'#markup' => '<p><strong>Date:</strong> ' . $date . '</p>',
'#weight' => -99,
);
}
return $output;
}