function revisioning_entity_prepare_view in Revisioning 7
Same name and namespace in other branches
- 8 revisioning.module \revisioning_entity_prepare_view()
Implements hook_entity_prepare_view().
First of the dont_display hooks.
File
- ./
revisioning.module, line 448 - Allows content to be updated and reviewed before submitting it for publication, while the current live revision remains unchanged and publicly visible until the changes have been reviewed and found fit for publication by a moderator.
Code
function revisioning_entity_prepare_view($entities, $entity_type, $langcode) {
if ($entity_type == 'node') {
foreach ($entities as $node) {
if (!empty($node->dont_display)) {
$node->title = FALSE;
// This == COMMENT_NODE_HIDDEN if Comment module enabled.
$node->comment = 0;
$node->link = FALSE;
unset($node->body);
unset($node->rss_elements);
}
else {
// Display, however suppress comment form when revision is not current.
if (isset($node->comment) && !empty($node->revision_moderation) && empty($node->is_current)) {
// Prevent comment_node_view() from adding the comment form.
// This == COMMENT_NODE_HIDDEN;
$node->comment = 0;
}
}
}
}
}