Hey everyone,

I've been excitedly testing Workbench Moderation, but I've run into one problem for sites that also use the popular Panels module to override a node's display.

Panels has a default "node template" panel that allows you to easily replace the standard display of a node with a panel instead (with variants based on the content type being viewed). This works great on Workbench Moderation's "View Published" tab, but when I click on "View Draft", the draft is not displayed using the Panel (instead it is using the default Drupal node display). Since our panel looks nothing like the default node display, "drafts" don't resemble the actual published node at all.

Any ideas on how to solve this? I tried creating an additional Panel that would override the "node/%node/draft" path, but it won't allow me to do so because it says that path is already in use.

Is deeper Panels integration needed?

Thanks,
Ben

Comments

Shadlington’s picture

I've hit this problem too.
Subbing.

Shadlington’s picture

This issue may be relevant, in that it pertains to adding page manager defaults for workbench: #1103638: Task plugin for 'admin/workbench'

Its not inclusive of workbench moderation but I would guess that similar work would be required.

dddbbb’s picture

I too am having his problem.

stevector’s picture

Title: Panels integration » Task plugin for 'node/%node/draft'
Category: support » feature

Yes, what we'd need is a task plugin to allow Page Manager to act on the path "node/%node/draft." Patches welcome.

It would look a lot like the patch I wrote in #1103638: Task plugin for 'admin/workbench'

SandraL’s picture

I've run up against this problem as well.

This isn't the most robust of solutions, but to get it working in my environment for now I changed the workbench_moderation_node_view_draft function in workbench_moderation.node.inc from

function workbench_moderation_node_view_draft($node) {
  $current_node = workbench_moderation_node_current_load($node);
  return node_page_view($current_node);
}

to

function workbench_moderation_node_view_draft($node) {
  $current_node = workbench_moderation_node_current_load($node);
  if (module_exists('page_manager'))
  	return page_manager_node_view_page($current_node);  //defined in ctools/page_manager/plugins/tasks/node_view.inc
  else
	return node_page_view($current_node);
}

At least, it seems to be working so far - my panel page drafts are showing up in panels and my non-panel page drafts aren't breaking.

stevector’s picture

That's an interesting approach and I imagine it helps to get around the the need to recreate a Panels layout at node/%node/%draft. I wonder if we could get that benefit in the task handler approach so as to avoid module_exists().

robeano’s picture

Priority: Normal » Critical

I don't consider this a 1.0 blocker but it seems like we should figure this out so wb and panels play well together. I'm going to mark this Critical and see what happens.

anon’s picture

The code in #5 works with some small edits, BUT if you you will get the wrong context, so if you using any context in your panel, they will be the current published node.

function workbench_moderation_node_view_draft($node) {
  $current_node = workbench_moderation_node_current_load($node);
  if (module_exists('page_manager')) {
    ctools_include('node_view', 'page_manager', 'plugins/tasks');
    return page_manager_node_view_page($current_node);  //defined in ctools/page_manager/plugins/tasks/node_view.inc
  }
  else {
    return node_page_view($current_node);
  }

}

We have to create a diffrent context that will load a node with a specific vid.

stevector’s picture

Status: Active » Needs review
StatusFileSize
new6.53 KB

I wrote a task plugin it works. I asked in IRC the best way to cleanly reuse the task handler (Panels) definition from node/%node inside of this task plugin. Merlinofchaos gave me a much simpler and better answer. He said that workbench_moderation_node_view_draft() should directly reuse whatever page callback is used at node/%node.

So the task plugin isn't necessary for the use case discussed in this thread. I've included it in the patch because I had already written it and there is a different use case for it. One could use it if there was a need for different Panels layouts at node/%node vs node/%node/draft.

In reviewing this patch please look at the way I use menu_get_item(). Should we be responding to more than include_file and page_callback?

Also to write the task plugin I did a lot of copy/past find/replace. Are there any strings that need to be updated yet?

dave reid’s picture

Priority: Critical » Major
anon’s picture

dave reid’s picture

@anon: Rather than creating a separate module that will eventually be deprecated, it would be really great if you could help review this issue here.

anon’s picture

StatusFileSize
new12.97 KB

The patch in #9 works fine, and I have used that patch and added support for node revisions aswell.

I will ask someone to remove workbench_panels when this issue is fixed.

anon’s picture

Title: Task plugin for 'node/%node/draft' » Task plugin for 'node/%node/draft' and 'node/%node/revisions/%/view'
becw’s picture

Assigned: Unassigned » becw

I can take a look at this patch.

elly’s picture

Interested in solutions here, thank you to people working on this problem which I also just ran into. Subbing.

Juan C’s picture

subscribe

elly’s picture

I can't get any of these solutions to work. The patch in #13 applies cleanly but I don't see new override options in page manager. I looked at workbench_panels, and did see the override options after installed it, but after creating overrides for node draft and node revision forms, I still didn't see those layouts presented when I went to the draft/revision creation pages in question. Am I missing something?

dixon_’s picture

subscribe

stevector’s picture

Assigned: becw » Unassigned
Status: Needs review » Reviewed & tested by the community

This patch works for me. Elly you may need to clear your caches to see the options at admin/structure/pages

stevector’s picture

Status: Reviewed & tested by the community » Closed (fixed)
stevector’s picture

Status: Closed (fixed) » Fixed

Used the wrong status in the last comment.

Status: Fixed » Closed (fixed)

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

delacosta456’s picture

Issue summary: View changes

hi
Please i would like to know if it has been added to workbench_moderation module?

thanks

joelpittet’s picture

yes in dev as mentioned in comment #21 @delacosta456. It will likely make it into the next release if no security stuff jumps ahead