Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Duplicating a page with child pages leads to double AutoIDs #60

Open
fabianmichael opened this issue Feb 8, 2021 · 1 comment
Open
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@fabianmichael
Copy link
Contributor

When a page is duplicated, the page only updates the AutoID field of the page itself. This leads to duplicate IDs for any duplicated child pages. As far as I understand, this can be fixed by using the page.duplicate:after hook:

  'page.duplicate:after' => function($duplicatePage, $originalPage) {
    foreach ($duplicatePage->index(true) as $item) {
      \Bnomei\AutoID::push($item, true);
    }
  },
@bnomei bnomei self-assigned this Feb 21, 2021
@bnomei bnomei added bug Something isn't working question Further information is requested labels Feb 21, 2021
@bnomei
Copy link
Owner

bnomei commented Feb 21, 2021

this should be take care of already.

'page.duplicate:after' => function ($duplicatePage) {

  • for now i am fixing the params to $duplicatePage, $originalPage.
  • and force index including drafts

bnomei added a commit that referenced this issue Feb 21, 2021
related #61

Signed-off-by: Bruno Meilick <b@bnomei.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants