kirby3-autoid icon indicating copy to clipboard operation
kirby3-autoid copied to clipboard

Duplicating a page with child pages leads to double AutoIDs

Open fabianmichael opened this issue 3 years ago • 1 comments

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);
    }
  },

fabianmichael avatar Feb 08 '21 13:02 fabianmichael

this should be take care of already. https://github.com/bnomei/kirby3-autoid/blob/dfd33b2caa81f04967a246af636579c08b06913d/index.php#L157

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

bnomei avatar Feb 21 '21 18:02 bnomei