function node_accessibility_revision_overview in Node Accessibility 7
Wraps or Replaces the node_revision_overview function.
This adds add an "accessibility" link.
$param object $node A node object.
Return value
array An array containing the overview page structure.
1 string reference to 'node_accessibility_revision_overview'
- node_accessibility_menu_alter in ./
node_accessibility.module - Implements hook_menu_alter().
File
- ./
node_accessibility.module, line 1295 - Module file for the node accessibility project.
Code
function node_accessibility_revision_overview($node) {
if (!user_access('access node accessibility tab')) {
return node_revision_overview($node);
}
drupal_set_title(t("Revisions for %title", array(
'%title' => $node->title,
)), PASS_THROUGH);
$header = array(
t("Revision"),
array(
'data' => t("Operations"),
'colspan' => 3,
),
);
$revisions = node_revision_list($node);
$rows = array();
$revert_permission = FALSE;
if ((user_access('revert revisions') || user_access('administer nodes')) && node_access('update', $node)) {
$revert_permission = TRUE;
}
$delete_permission = FALSE;
if ((user_access('delete revisions') || user_access('administer nodes')) && node_access('delete', $node)) {
$delete_permission = TRUE;
}
foreach ($revisions as $revision) {
$row = array();
$operations = array();
if ($revision->current_vid > 0) {
$row[] = array(
'data' => t("!date by !username", array(
'!date' => l(format_date($revision->timestamp, 'short'), 'node/' . $node->nid),
'!username' => theme('username', array(
'account' => $revision,
)),
)) . ($revision->log != '' ? "<p class='revision-log'>" . filter_xss($revision->log) . "</p>" : ""),
'class' => array(
'revision-current',
),
);
$operations[] = array(
'data' => drupal_placeholder(t("current revision")),
'class' => array(
'revision-current',
),
'colspan' => 3,
);
}
else {
$row[] = t('!date by !username', array(
'!date' => l(format_date($revision->timestamp, 'short'), 'node/' . $node->nid . '/revisions/' . $revision->vid . '/view'),
'!username' => theme('username', array(
'account' => $revision,
)),
)) . ($revision->log != '' ? "<p class='revision-log'>" . filter_xss($revision->log) . "</p>" : '');
$operations[] = l(t("accessibility"), 'node/' . $node->nid . '/accessibility/' . $revision->vid . '/revision');
if ($revert_permission) {
$operations[] = l(t("revert"), 'node/' . $node->nid . '/revisions/' . $revision->vid . '/revert');
}
if ($delete_permission) {
$operations[] = l(t("delete"), 'node/' . $node->nid . '/revisions/' . $revision->vid . '/delete');
}
}
$rows[] = array_merge($row, $operations);
}
$build['node_revisions_table'] = array(
'#theme' => 'table',
'#rows' => $rows,
'#header' => $header,
);
return $build;
}