Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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');
Comment | File | Size | Author |
---|---|---|---|
#6 | cck-blocks-workbench-integration-1309870-6.patch | 1.51 KB | DanielVeza |
#5 | cck-blocks-workbench-integration-1309870-5.patch | 2.01 KB | DanielVeza |
#1 | cck-blocks-workbench-integration-1309870-1.patch | 697 bytes | gleroux02 |
Comments
Comment #1
gleroux02 CreditAttribution: gleroux02 commentedAdding a patch which checks if arg(2) is 'draft'.
Comment #2
emilekott CreditAttribution: emilekott commentedThe 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)
Comment #3
damien_vancouver CreditAttribution: damien_vancouver commentedBased 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.
Comment #4
Pierco CreditAttribution: Pierco commentedI agree with Damien but #2 is enough for me to do the job. Thanks Gleroux02!
Comment #5
DanielVezaIt'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.
Comment #6
DanielVezaJust 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.
Comment #7
damien_vancouver CreditAttribution: damien_vancouver as a volunteer commentedHi @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!
Comment #8
DanielVezaAwesome, Grab me if anything sticks out or needs further work!