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.
Problem/Motivation
Currently cloning a panels display (as used in page manager handlers) leads to duplicated uuids: #2253919: The UUIDs of cloned variant and relative panes are the same of original ones
Proposed resolution
As soon as the related ticket is solved we can call the newly introduced method there and solve the issue.
We need the method_exists()
to ensure the code is backward compatible.
Remaining tasks
Reviews needed.
User interface changes
None.
API changes
None.
Comments
Comment #1
chris.guitarte CreditAttribution: chris.guitarte commentedHi @das-peter - thanks for pointing me to this patch. I applied this patch as well as the one in the The UUIDs of cloned variant and relative panes are the same of original ones and while it works for the custom panel pages I create and clone... it does not work for the system page I am overriding and as it renames the variant that I am trying to clone.
The steps to recreate are to:
Comment #2
das-peter CreditAttribution: das-peter commentedAdjusted patch. I use now
panels_panel_context_get_display()
to ensure the display handler is loaded before the cloning is done.Comment #3
ndf CreditAttribution: ndf commentedIt's not working yet.
My tests:
Clone a full Panel including all it's variants.
Result:
- Handlers get new source-UUID (good)
[handlers get new (machine)name (not part of this patch, but related)]
Clone a handler from a custom Panel Page (with a custom url).
This is a variant in the 'full Panel'.
Result:
- new Handler (the clone-target) gets a new UUID (good)
- old Handler (the clone-source) gets a new UUID (bad)
- Handlers not part of cloning, but part of Panel keep their original UUID (good)
Clone a handler from a module declared Page (a.k.a. node_view)
Result:
- new Handler (the clone-target) gets a new UUID (good)
- old Handler (the clone-source) gets a new UUID (bad)
- Handlers not part of cloning, but part of Panel keep their original UUID (good)
Comment #4
ndf CreditAttribution: ndf commentedSeems to work now :)
Calls the ->clone_display() after the display is added to the Page.
This solves:
Clone a handler from a custom Panel Page (with a custom url).
This is a variant in the 'full Panel'.
- old Handler (the clone-source) gets a new UUID (now good)
Clone a handler from a module declared Page (a.k.a. node_view)
Result:
- old Handler (the clone-source) gets a new UUID (now good)
On github: https://github.com/ndf4/ctools/tree/issue/2449245-CreateNewUUIDsWhenClon...
Comment #5
ndf CreditAttribution: ndf commentedMade a minor change to the routine.
Now using the initialised handler object, instead of (possible empty) one in the $form_state .
I found out in some cases
$form_state['handler']->conf['display']
was not set, all-tough$handler
was.The method
clone_display
is now push to panels-7.x-dev, so this patch is easier to review!Comment #6
DamienMcKennaComment #7
B-Prod CreditAttribution: B-Prod commented@ndf: thanks for your work
This is the same patch as #5, with a file name that follows the Drupal naming conventions.
The spaces in the patch name make it really difficult to read when used on a distribution make file...
Comment #8
DamienMcKennaMoving this to the v7.x-1.10 release plan.
Comment #9
DamienMcKennaThis didn't get added to 7.x-1.10, bumping it to 7.x-1.11.
Comment #10
DamienMcKennaBumping to 1.12.
Comment #11
rivimeyPatch applies fine on current 7.x-1.x.
I've reviewed the latest patch, and it seems reasonable, in that it offloads the regeneration of uuids to panels, which can presumably do the right thing with them, and does so in a way that should be fine for backward compatibility.
It would be good to see the test suite extended for this, but I'm not at all sure how it would be done in this case. Can @ndf help?
Comment #12
DamienMcKennaI have some code in Panelizer I can rework for CTools to cover this scenario.
Comment #13
ndf CreditAttribution: ndf commented@rivimey #11
Do you mean the automatic test-suite? That would definitely help this type of issues.
It is a long time ago I was working on this. So I am kinda lost howto start up again :(
Base-line is that there are 2 ways to clone page-manager-handlers:
- First is cloning a single one
- Second is cloning the whole page/panel with all it's handlers.
@DamienMcKenna #12
Can you point on that? I can pick up in November.
@all Is 'needs test' the blocker for this issue?
Comment #14
rivimeyHi @ndf, I did mean the automatic test suite -- simpletest et al. And you're forgiven for not remembering details >1yr later :-)
Nobody has added 'needs test' to the tags, so I guess it is not a 'blocker', but @DamienMcKenna and I are keen to see more tests constructed for ctools, given it is used so much and has such a poor test suite at present.
So if you +/- Damien could get some tests started that would be much appreciated :-)
Comment #15
rivimeyComment #16
japerryLooks good to me. Tests would be awesome, but I'm not going to let that block this issue from getting in.
Committed.
Comment #18
DamienMcKennaAwesome! Thanks japerry! BTW there's test coverage in Panelizer I'll re-enabled after the forthcoming CTools release.
Comment #20
khaldoon_masud CreditAttribution: khaldoon_masud commentedI am using panels-7.x-3.7 and ctools-7.x-1.12 but it's still not working for me.
Comment #21
rivimeykhaldoon_masud you should open a new issue with precise details of the problem you are seeing...