Motivation

The Workbench Moderation allows a node to create a new revision and to have that revision in a draft state. Currently when viewing that draft any cck blocks that are being used are not displaying their content. The pattern for a node's draft is node/nid/draft.

Proposed resolution

To fix this, I propose to alter how $display_nodecontent is set by also checking if arg(2) equals draft.

API changes

Changing how $display_nodecontent is set.
From:
$display_nodecontent = (!arg(2) || arg(2) == 'revisions' && is_numeric(arg(3)));
To:
$display_nodecontent = (!arg(2) || arg(2) == 'revisions' && is_numeric(arg(3)) || arg(2) == 'draft');

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gleroux02’s picture

Adding a patch which checks if arg(2) is 'draft'.

emilekott’s picture

The patch in #1 allows the content of the field to be displayed but if the fields are updated, the published values are shown in the draft (rather than the draft values)

damien_vancouver’s picture

Status: Active » Needs work

Based on the problem in #2, I'd suggest trying to do this with Display Suite's region as block functionality, and see if it properly respects the workbench draft states and shows the fields correctly.

To use Region as Block, you must turn on the DS Extras module, then turn that option on in Structure->Display Suite->Extras, under "other".

then set yourself up a Display Suite region as a block, and try putting your content in there, and finally try it all with a draft and a published revision. See if it works!

If not, then we could certainly look at adding this functionality to cck_blocks, if we resolve #2. Although... it could be argued that we should pursue fixing it in DS, not cck_blocks.

Pierco’s picture

I agree with Damien but #2 is enough for me to do the job. Thanks Gleroux02!

DanielVeza’s picture

It's a small user group that this applies to I imagine, but I'm adding a patch here which builds on top of the patch in #1. The CCK block is displayed properly in the workbench moderation "draft" status, and it shows the draft content.

DanielVeza’s picture

Just found that the dev version of cck blocks has an install error, so here is the patch for the 7.x.1.1 version.

Note - Not sure if this is the nicest way to do this. Feel free to correct me if anyone sees this patch.

damien_vancouver’s picture

Hi @DanielVeza,

Thanks for the patches.. they look OK to me, I will give it a test this and and commit to the -dev branch.

Regarding a new release, I've been very hesitant to push a new version out, as that would upgrade thousands and thousands of sites, and I'm not certain that the changes we've made since stable will work in 100% of those cases.

So I will get this stuff into 7.x-1.x-dev, and then anyone wishing to run these latest changes we've made can run the dev branch.. while people already on the stable 1.x will keep the old logic with no code changes.

I won't be porting this module to Drupal 8 - it's really reached the end of its useful life and there are more modern approaches that work better for doing the same thing.... so at this point it's all about stability.

thanks again for that patch, I will test and get it committed to dev!

DanielVeza’s picture

Awesome, Grab me if anything sticks out or needs further work!