It appears there's no way to edit the Panelizer content/layout/settings for non-current node revisions. I've done a little digging and added some menu callbacks, etc. It seems the key limitation here is that panelizer_panels_cache_get() doesn't differentiate based on revision. Am I barking up the wrong tree?

I'm continuing to look into this in hope of rolling a patch but perhaps someone with better architectural knowledge of panels/panelizer can weigh in on the best approach.

Comments

I've updated panelizer_panels_cache_get() and have basic editing working but links for operations on my content panes (settings, disable, etc.) don't pass the vid in the ajax request. Looks like I'll have to dig deeper into the architecture here. I seem to recall that this works in the IPE so perhaps I can learn something from work done there...

Status:Active» Closed (duplicate)

Status:Closed (duplicate)» Active

Damien: I saw that issue but it seems focused on the problem of extra unwanted revisions when saving in Panelizer.

This issue is about being able to use the Panelizer interface to edit non-current node revisions. There seem to be a number of architectural issues preventing this currently. FWIW, (though I don't see how it pertains to this issue) I'm not using Revisioning or Workbench Moderation but rather State Machine.

If you still think there's sufficient overlap I can continue this discussion on #1402860: Panelizer is incompatible with moderation, but this seems like a distinct issue to me.

@azinck: I stand corrected.

StatusFileSize
new8.25 KB

Here's a first-pass at a patch against 2.x-dev. Works for me, YMMV.

Status:Active» Needs review

Preliminary review of ui appears that this patch fixes issues with the revisioning module. Was able to go through a few iterations of the revision/moderation process and change layouts between.

May offer a more formal RTBC when I get a chance to review later tonight or tomorrow morning.

Just a note: I found another revision-related "bug". Creating a new revision of a node does not always/automatically create a new panels display. A new panels display is only created if you made a change to the display at the time the new node revision is created. I think it makes more sense to always create a new display. I'll work on updating the patch...

The patch in #5 does not resolve the problem for me, at least when using Revisionining.

Status:Needs review» Needs work

At the very least the patch needs to be fixed to use the Drupal coding standards.

Status:Needs work» Needs review
StatusFileSize
new884 bytes

This is an updated version of my patch from #1402860: Panelizer is incompatible with moderation that now works correctly with all of the Panelizer subpage settings so that the core Revisions option is properly adhered to.

I'll update it to match coding standards.

Damien: you said it does not "resolve the problem" for you. Specifically which problem were you testing? The patch in #5 allows me to edit non-current node revisions at node/%node/revisions/%/panelizer -- does that not work for you?

The patch applies cleanly to both the 7.x-2.x and 7.x-3.x branches, but has only been tested with the 7.x-2.x branch.

Apologies, I posted the patch to the wrong issue, my patch was for #1804156: Panelizer always creates a new revision.

StatusFileSize
new8.22 KB

Updated azinck's patch to match coding standards and tidied up the path-related code in PanelizerEntity->page_layout().

Status:Needs review» Needs work

The patch should add a new Panelizer item to the secondary tabs, beside the revision-specific links for edit & view, at least it doesn't when using Revisioning.

I didn't add those tabs because there's no good place to "hang" the revision-specific Panelizer tabs in core. We could check for the existence of specific modules (like Revisioning or State Machine) and adjust the menu as appropriate, but I felt it was more the role of those modules to add support for Panelizer (through hook_menu_alter) rather than the other way around.

Version:7.x-2.x-dev» 7.x-3.x-dev
Status:Needs work» Needs review
StatusFileSize
new8.66 KB

Rerolled for the 7.x-3.x branch.

StatusFileSize
new8.65 KB

There is no entity_load_single() function in D7.

Status:Needs review» Needs work

I'm now getting the error "Unsupported operand types in entity.inc on line 355" so will have to debug this further.

StatusFileSize
new9.48 KB

WIP, and it needs a patch added to Workbench Moderation.. I'll be working on this some more tomorrow.

Status:Needs work» Needs review
StatusFileSize
new9.82 KB

This patch fixes some of the problems with the last one, so you can at least now load all of the Panelizer pages for each revision. This requires the patch from #1868144: Allow the node history list to be customized.

Status:Needs review» Needs work
StatusFileSize
new1.95 KB
new48.91 KB

Doing further testing and the patch in #23 doesn't work correctly, there's confusion over what the correct paths should be. I've worked up a quick plan for how the URL hierarchy should be (PNG and OmniOutliner formats), tomorrow I'll update the patch to match.

StatusFileSize
new1.92 KB

Argh, wrong issue. Sorry

StatusFileSize
new9.78 KB

Fixed at least part of the problem with the patch in #23, but it needs some further work.

With the patch in #26 it is no longer possible to open the Settings dialog for panes, you get the following error instead:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /panels/ajax/editor/edit-pane/panelizer%3Adefault%3Anode%3Apage.page_manager%3Anode%3Apage%3Adefault2%3Anode/10
StatusText: OK
ResponseText: [{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"seven","theme_token":"2ltDBsyWbN0xIfDeh15GkHYbOzP5C_XB76Tn0VF2HTE"}},"merge":true},{"command":"modal_display","title":"Error","output":"Invalid pane id."}][{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"seven","theme_token":"2ltDBsyWbN0xIfDeh15GkHYbOzP5C_XB76Tn0VF2HTE"}},"merge":true},{"command":"modal_dismiss"}]

I've identified the symptom - without this patch the Edit link's URL is as follows:

panels/ajax/editor/edit-pane/panelizer:default:node:page.page_manager:node:page:default2/10

With the patch the URL changes to:

panels/ajax/editor/edit-pane/panelizer:default:node:page.page_manager:node:page:default2:node/10

Now to find out why.

Status:Needs work» Needs review
StatusFileSize
new10.12 KB

This patch fixes the problem with opening any of the contextual menu items from the Content pane. One step closer.

FYI the problem was the $cache->display->cache_key line in panelizer_panels_cache_get(), when editing a default display object, rather than a per-entity display override, the $vid variable would end up being the entity type, e.g. 'node', so this was being appended to the cache_key. My fix for that was to do an additional is_numeric() check.

StatusFileSize
new14.24 KB

Updated patch that has the local tasks as close to correct as I can make them.

FYI the patch in #30 doesn't require the CTools patch to display revisions properly as Workbench Moderation already handles that, however editing & saving revisions still isn't working quite right.

StatusFileSize
new14.38 KB

Correct make_fake_tabs() for when Workbench Moderation is enabled and you're viewing a non-current revision.

editing & saving revisions still isn't working quite right

Using patched workbench moderation and the patch in #32, after you save your panelizer changes, the page reloads and it appears to revert and you have lost the changes. What happens is that a new current revision is created with the changes you have made. It's only a UI thing that makes it appear that the save hasn't happened, because you're still on the old revision's page.

I will reject a patch that creates new displays unnecessarily; displays can be heavy, and revisions can happen a lot. I am very specific about not exploding the display table. Imagine a site with 1 million panelized nodes and an average of 5 revisions per node and an average of 10 panes per panel. That's 50 million pane entries, and some large percentage of that (probably 90%) are pure duplication -- and these are not high averages.

Status:Needs review» Needs work

Working on a reroll.

@merlinofchaos: The goal is not to create new displays unnecessarily.

StatusFileSize
new14.17 KB

Rerolled.

The node/:node/revisions/:revision/panelizer/page_manager/:task pages aren't loading correctly..

StatusFileSize
new14.19 KB

Just a re-roll of #36.

Could you provide steps for testing your patch?

I'm getting those notices several times when saving a display for a not published revision (via node/[nid]/revisions) after applying this patch:

Notice: Undefined offset: 3 in _menu_translate() (line 777 of /Users/henrique/Sites/panelizer/includes/menu.inc).
Notice: Undefined offset: 3 in _menu_translate() (line 783 of /Users/henrique/Sites/panelizer/includes/menu.inc).

Panelizer still saves the latest revision but discards the changes done in the display.

Also when editing the display for a not published revision and clicking the "+" button for adding content to some region, it breaks with the following javascript alert and the throbber keeps spinning forever:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /panels/ajax/ipe/select-content/panelizer%3Anode%3A7%3Adefault/center
StatusText: OK
ResponseText: [{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"bartik","theme_token":"4N3HuOBbpY6jt7nQdXK5gDWspo0LONp6seB5PRqMx7k"}},"merge":true},{"command":"modal_display","title":"Error","output":"Invalid input"}][{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"bartik","theme_token":"4N3HuOBbpY6jt7nQdXK5gDWspo0LONp6seB5PRqMx7k"}},"merge":true},{"command":"modal_display","title":"Add content to ","output":"\u003Cdiv class=\u0022panels-add-content-modal\u0022\u003E\n  \u003Cdiv class=\u0022panels-section-column panels-section-column-categories\u0022\u003E\n    \u003Cdiv class=\u0022inside\u0022\u003E\n      \u003Cdiv class=\u0022panels-categories-box\u0022\u003E\n              \u003Ca href=\u0022\/panels\/ajax\/ipe\/select-content\/panelizer%3Anode%3A7%3Adefault\/center\/activity\u0022 class=\u0022use-ajax panels-modal-add-category\u0022 title=\u0022\u0022\u003EActivity\u003C\/a\u003E              \u003Ca href=\u0022\/panels\/ajax\/ipe\/select-content\/panelizer%3Anode%3A7%3Adefault\/center\/comment\u0022 class=\u0022use-ajax panels-modal-add-category\u0022 title=\u0022\u0022\u003EComment\u003C\/a\u003E              \u003Ca href=\u0022\/panels\/ajax\/ipe\/select-content\/panelizer%3Anode%3A7%3Adefault\/center\/form\u...nelizer\/sites\/all\/modules\/ctools\/plugins\/content_types\/node\/icon_node.png\u0022 alt=\u0022\u0022 \/\u003E\u003C\/a\u003E  \u003Cdiv\u003E\u003Ca href=\u0022\/panels\/ajax\/ipe\/add-pane\/panelizer%3Anode%3A7%3Adefault\/center\/node\/node\u0022 class=\u0022use-ajax panels-modal-add-config\u0022 title=\u0022Add a node from your site as content.\u0022\u003EExisting node\u003C\/a\u003E\u003C\/div\u003E\r\n\u003C\/div\u003E\r\n\u003Cdiv class=\u0022content-type-button clearfix\u0022\u003E\r\n  \u003Ca href=\u0022\/panels\/ajax\/ipe\/add-pane\/panelizer%3Anode%3A7%3Adefault\/center\/custom\/custom\u0022 class=\u0022use-ajax panels-modal-add-config\u0022 title=\u0022Create a completely custom piece of HTML content.\u0022\u003E\u003Cimg typeof=\u0022foaf:Image\u0022 src=\u0022http:\/\/panelizer\/sites\/all\/modules\/ctools\/images\/no-icon.png\u0022 alt=\u0022\u0022 \/\u003E\u003C\/a\u003E  \u003Cdiv\u003E\u003Ca href=\u0022\/panels\/ajax\/ipe\/add-pane\/panelizer%3Anode%3A7%3Adefault\/center\/custom\/custom\u0022 class=\u0022use-ajax panels-modal-add-config\u0022 title=\u0022Create a completely custom piece of HTML content.\u0022\u003ENew custom content\u003C\/a\u003E\u003C\/div\u003E\r\n\u003C\/div\u003E\r\n    \u003C\/div\u003E\n  \u003C\/div\u003E\n\n  \n      \u003Cdiv class=\u0022panels-categories-description\u0022\u003E\n      Content options are divided by category. Please select a category from the left to proceed.    \u003C\/div\u003E\n  \n  \u003C\/div\u003E\n"}]

Tentatively adding this to the todo list for the next release.

Component:Code» Revisions