Yet if you use node_revision title and use "link to node" it does not respect the version at all, it simply links to the live version.

So we need to provide our own title field which links to the revision.

CommentFileSizeAuthor
#4 views-node_revision_link.patch3.12 KBdawehner

Comments

eugenmayer’s picture

Title: Views: Create new field "Link to revision" labeled as title » Views: Create new field "Link to revision" labled as title
Priority: Normal » Critical
eugenmayer’s picture

Category: feature » bug

Without this feature views integration are pretty useless, so this is rather a bug then a feature.

dawehner’s picture

Title: Views: Create new field "Link to revision" labled as title » Link to revision, for revision fields
Project: Content moderation » Views (for Drupal 7)
Version: 6.x-1.0-beta4 » 6.x-3.x-dev
Component: Views integration » node data
Category: bug » feature
Priority: Critical » Normal
Status: Needs work » Active

You can do this sure without an extra handler, but i think this is a missing feature for views

$view = new view;
$view->name = 'node_revisions';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node_revisions';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Node: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['exclude'] = TRUE;
$handler->display->display_options['fields']['nid']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['nid']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['nid']['alter']['trim'] = 0;
$handler->display->display_options['fields']['nid']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['nid']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['nid']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['nid']['alter']['html'] = 0;
$handler->display->display_options['fields']['nid']['hide_empty'] = 0;
$handler->display->display_options['fields']['nid']['empty_zero'] = 0;
$handler->display->display_options['fields']['nid']['link_to_node'] = 0;
/* Field: Node revision: Vid */
$handler->display->display_options['fields']['vid']['id'] = 'vid';
$handler->display->display_options['fields']['vid']['table'] = 'node_revisions';
$handler->display->display_options['fields']['vid']['field'] = 'vid';
$handler->display->display_options['fields']['vid']['exclude'] = TRUE;
$handler->display->display_options['fields']['vid']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['vid']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['vid']['alter']['trim'] = 0;
$handler->display->display_options['fields']['vid']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['vid']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['vid']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['vid']['alter']['html'] = 0;
$handler->display->display_options['fields']['vid']['hide_empty'] = 0;
$handler->display->display_options['fields']['vid']['empty_zero'] = 0;
/* Field: Node revision: Title */
$handler->display->display_options['fields']['title_1']['id'] = 'title_1';
$handler->display->display_options['fields']['title_1']['table'] = 'node_revisions';
$handler->display->display_options['fields']['title_1']['field'] = 'title';
$handler->display->display_options['fields']['title_1']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title_1']['alter']['make_link'] = 1;
$handler->display->display_options['fields']['title_1']['alter']['path'] = 'node/[nid]/revisions/[vid]/view';
$handler->display->display_options['fields']['title_1']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title_1']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['title_1']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['title_1']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title_1']['alter']['html'] = 0;
$handler->display->display_options['fields']['title_1']['hide_empty'] = 0;
$handler->display->display_options['fields']['title_1']['empty_zero'] = 0;
$handler->display->display_options['fields']['title_1']['link_to_node'] = 0;
dawehner’s picture

Status: Active » Needs review
StatusFileSize
new3.12 KB

So here is a patch

eugenmayer’s picture

Thank you a lot Daniel! This makes the views integration pretty useable!

Well, i guess the node.views patch wont get into the node.module for 6.x anymore. Do we have any chances to hack arround that people do not have to hack core?

eugenmayer’s picture

I guess your first suggestion is creating a view by "coding", right? So the only way to accomplish it without patching core (yet) is providing a hardcoded view?

Are there other options Daniel? Sorry that iam not able to investigate to much here, this is far beyond my "views" knowledge yet (though i hope to catch you up someday :) )

dawehner’s picture

@eugenmayer

Views creates a abstract API for building lists of content. Additional it implements the views api for the core modules. I think you will make a /facepalm:)
Thats not a hardcoded views.

eugenmayer’s picture

Tested in a fresh Drupal 6.15 with views / content_moderation and it worked flawlessly.

Thank you Daniel!

eugenmayer’s picture

Status: Needs review » Reviewed & tested by the community
merlinofchaos’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed to 2.x and 3.x -- does not apply to 7.x, needs to be ported.

eugenmayer’s picture

Thanks Daniel and merlinofchaos

dawehner’s picture

Status: Patch (to be ported) » Fixed

and commited.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.