If you've got a panelized node and you're using node_clone it'd be really nice if panelizer cloned the panels display and other panelizer settings, instead of just giving you the default display for that node type.
It might be possible to do all this just inside panelizer_nodeapi() with enough smarts about if we're trying to insert a $node with a real display ID but no nid, we can assume that's a cloned node and we should clone the display. Otherwise, node_clone() provides some hooks for us to alter $node during cloning so we can explicitly flag what's happening in $node so that panelizer_nodeapi() doesn't have to guess.
I need this ASAP for something I'm working on, so I'm assigning to myself and going to give it a go...
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 1205304-2.panelizer-node-clone.D6.patch | 2.59 KB | dww |
Comments
Comment #1
dwwFirst hurdle is a bug in node_clone itself: #654508-9: Add a way to determinee that a node was a clone. Ugh. For now, I'll at least see if I can get this working for the save-edit node_clone method. Stay tuned...
Comment #2
dwwNotwithstanding the bug I mentioned in #1 where this doesn't work with node_clone's prepopulate method, the attached patch for D6 appears to be working great in my testing.
Comment #3
merlinofchaos commentedSince dww's testing shows it works, my eyeball review of the code thinks this is okay.
Comment #4
dwwHeh, except we don't want to try to clone the panelizer data on nodes that aren't panelized. ;) Fixed that, and pushed to D6:
http://drupal.org/commitlog/commit/18014/00a01e3638f82fe794470fd0da4d539...
Ported to D7, tested, and got that working, too. Oddly, I needed to reset the node_load() cache inside panelizer_node_insert() for this to work -- not sure why. Also, drupal_clone() is gone in favor of PHP 5's native clone method. And of course, there's no hook_nodeapi(), just hook_node_insert(). Anyway, since I got it working, I went ahead and committed and pushed:
http://drupal.org/commitlog/commit/18014/5e9891f51bad817528a22d413f6b9fd...
Note that node_clone itself is still pretty busted on D7 -- I had to use the patch from #986242: Drupal 7 fixes. to test this at all.
Comment #6
projectalpha commentedThanks. Reply #4 helped me a lot.
Comment #7
a.milkovskyThe issue is still relevant. Looks like this feature has gone in D7.
The issue is present is the 'Customize display' widget is on the page.
Panelizer is not cloned with node because the 'Customize display' widget, which has the name 'panelizer'. This spoils the saving logic because of the variables conflict.
The conflict happens here in entity_form_submit_build_entity():
My fix:
Created new issue #2811229: Panelizer is not cloned when 'Customize display' widget is present