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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chris.guitarte’s picture

Hi @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:

  • Enable/Override a system page at: admin/structure/pages (I chose the user profile)
  • Create a new variant of the system page
  • Clone variant
das-peter’s picture

Adjusted patch. I use now panels_panel_context_get_display() to ensure the display handler is loaded before the cloning is done.

ndf’s picture

Status: Needs review » Needs work

It'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)

ndf’s picture

Seems 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...

ndf’s picture

Made 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!

B-Prod’s picture

@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...

DamienMcKenna’s picture

Moving this to the v7.x-1.10 release plan.

DamienMcKenna’s picture

This didn't get added to 7.x-1.10, bumping it to 7.x-1.11.

DamienMcKenna’s picture

rivimey’s picture

Status: Needs review » Reviewed & tested by the community

Patch 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?

DamienMcKenna’s picture

I have some code in Panelizer I can rework for CTools to cover this scenario.

ndf’s picture

@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?

rivimey’s picture

Hi @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 :-)

rivimey’s picture

japerry’s picture

Status: Reviewed & tested by the community » Fixed

Looks good to me. Tests would be awesome, but I'm not going to let that block this issue from getting in.

Committed.

  • japerry committed de8ad72 on 7.x-1.x authored by ndf
    Issue #2449245 by ndf, das-peter: Cloning page manager handlers leads to...
DamienMcKenna’s picture

Awesome! Thanks japerry! BTW there's test coverage in Panelizer I'll re-enabled after the forthcoming CTools release.

Status: Fixed » Closed (fixed)

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

khaldoon_masud’s picture

I am using panels-7.x-3.7 and ctools-7.x-1.12 but it's still not working for me.

rivimey’s picture

khaldoon_masud you should open a new issue with precise details of the problem you are seeing...