Hi there,
I have an Issue when I’m moving a page programmaticly, the sorting number of the old siblings stay the same and leave a “gap” in the sorting numbers. This wouldn’t be a great issue if everything is handled in the panel, but since there are also pages created programmaticly that should be appended to the old parent this can result in duplicated sorting numbers.
In my case old blogarticles get moved to an archive and new references create an automated new blogarticle.
Is there any way to resort the children of a page after on child is moved? Maybe something similar to $page->resortSiblingsAfterUnlisting();
in the PageAction.php?
I also tried to iterate through all the old siblings and change the sorting number, but it stops after the first sibling…
$kirby->impersonate('kirby');
try {
$siblings = $page->siblings();
$i = 1;
foreach($siblings as $sib){
$n = $i++;
$sib->changeNum($n);
}
}
Another strange thing is that I already created an archive a couple years ago with the same functions, but at that time the move
action wasn’t available. Back then I copied the page and deleted the original, that way the sorting numbers where updated. This doesn’t work either anymore. So maybe somebody has any idea how to solve this.
Thanks in advance
cheers
tom