function _theme_node_revisions in Revisioning 6
Theme the revisions of the supplied node in a table.
Parameters
$node: Node whose revisions to display
$show_terms: Whether to display a column showing each revision's taxonomy term(s)
Return value
Themed table HTML
1 call to _theme_node_revisions()
- revisioning_node_revisions in ./
revisioning.module - Display all revisions of the supplied node in a themed table.
File
- ./
revisioning.module, line 420
Code
function _theme_node_revisions($node) {
drupal_set_title(t('Revisions of %title', array(
'%title' => $node->title,
)));
$show_taxonomy_terms = module_exists('taxonomy');
$revisions = _get_all_revisions_for_node($node->nid, $show_taxonomy_terms);
$message = format_plural(count($revisions), 'This content has only one revision', 'This content has @count revisions.');
$links = array();
if ($node->status && module_grants_node_revision_access('unpublish current revision', $node)) {
$links[] = l(t('Unpublish current revision'), "node/{$node->nid}/unpublish");
}
if (module_grants_node_revision_access('delete revisions', $node)) {
$links[] = l(t('Delete all revisions'), "node/{$node->nid}/delete");
}
drupal_set_message(empty($links) ? $message : $message . theme('item_list', $links));
$header = array(
t('Revision'),
);
if ($show_taxonomy_terms) {
$header[] = t('Term');
}
$header[] = t('Status');
$rows = array();
foreach ($revisions as $revision) {
$row = array();
$base_url = "node/{$node->nid}/revisions/{$revision->vid}";
$t = t(' Saved !date by !username', array(
'!date' => l(format_date($revision->timestamp, 'small'), "{$base_url}/view"),
'!username' => theme('username', $revision),
)) . ($revision->log != '' ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : '');
if ($revision->vid == $node->vid) {
$row[] = array(
'data' => $t,
'class' => 'revision-current',
);
if ($show_taxonomy_terms) {
$row[] = array(
'data' => $revision->term,
'class' => 'revision-current',
);
}
$row[] = array(
'data' => theme('placeholder', $revision->status ? t('current revision (published)') : t('current revision (unpublished)')),
'class' => 'revision-current',
);
}
else {
$row[] = array(
'data' => $t,
);
if ($show_taxonomy_terms) {
$row[] = array(
'data' => $revision->term,
);
}
$row[] = array(
'data' => $revision->vid > $node->vid ? t('pending moderation') : t('old'),
);
}
$rows[] = $row;
}
return theme('table', $header, $rows);
}