If the theme's page.tpl outputs anything to do with the node, using $variables['node'] that is available in page.tpl (and associated theme preprocess functions), then on node/XX/draft these show values from the published node, rather than the current draft.
This is because template_preprocess_page() does the following to load the node:
if ($node = menu_get_object()) {
$variables['node'] = $node;
}
and the menu router item 'node/%node/draft' causes menu_get_object() to have the current published version of the node.
(Compare with node module's 'node/%node/revisions/%/view' menu router item, which passes the revision ID to node_load().)
The only way I can see to fix this is to change the menu loader in the 'node/%node/draft' path to something that loads the desired revision.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 2536386.workbench_moderation.draft-view-node-revision-page-template.patch | 1.27 KB | joachim |
Comments
Comment #1
joachim commentedHere's a patch.
It changes the draft router item to use a custom menu loader function, and uses tab_root and tab_parent in hook_menu() to ensure the draft view page remains as a tab on the node.
Comment #2
das-peter commented@joachim Are you sure this is for the 2.x branch? Other than that I think this makes sense :)
Comment #3
joachim commentedAh yes you're right, my project is using 1.4. I don't think I'll have time to investigate this on the 2.x branch, sorry.
Comment #4
das-peter commentedBranch 2.x looks pretty similar I guess. Will try to adapt you patch. So thanks!!
Comment #6
das-peter commentedMade a forward-port of the patch. I'd say this is good to go for 1.x too.
Comment #7
sbubaron commentedThis patch doesn't seem to be working for me. D7 with Workbench Moderation 1.4 -- with this patch installed I no longer have a node object available to me in my preprocess_page hook. Without it I get the latest published version at least.