concrete/src/Page/Page.php
public function movePageDisplayOrderToSibling(Page $c, $position = 'before')
    {
        $myCID = $this->getCollectionPointerOriginalID() ?: $this->getCollectionID();
        $relatedCID = $c->getCollectionPointerOriginalID() ?: $c->getCollectionID();
        $pageIDs = [];
        $db = Database::connection();
        $r = $db->executeQuery('select cID from Pages where cParentID = ? and cID <> ? order by cDisplayOrder asc', [$this->getCollectionParentID(), $myCID]);
        while (($cID = $r->fetchColumn()) !== false) {
            if ($cID == $relatedCID && $position == 'before') {
                $pageIDs[] = $myCID;
            }
            $pageIDs[] = $cID;
            if ($cID == $relatedCID && $position == 'after') {
                $pageIDs[] = $myCID;
            }
        }
        $displayOrder = 0;
        foreach ($pageIDs as $cID) {
            $co = self::getByID($cID);
            $co->updateDisplayOrder($displayOrder);
            ++$displayOrder;
        }
    }
public function movePageDisplayOrderToSibling(Page $c, $position = 'before')
    {
        $myCID = $this->getCollectionPointerOriginalID() ?: $this->getCollectionID();
        $relatedCID = $c->getCollectionPointerOriginalID() ?: $c->getCollectionID();
        $pageIDs = [];
        $db = Database::connection();
        $r = $db->executeQuery('select cID from Pages where cParentID = ? and cID <> ? order by cDisplayOrder asc', [$this->getCollectionParentID(), $myCID]);
        while (($cID = $r->fetchColumn()) !== false) {
            if ($cID == $relatedCID && $position == 'before') {
                $pageIDs[] = $myCID;
            }
            $pageIDs[] = $cID;
            if ($cID == $relatedCID && $position == 'after') {
                $pageIDs[] = $myCID;
            }
        }
        $displayOrder = 0;
        foreach ($pageIDs as $cID) {
            $co = self::getByID($cID);
            $co->updateDisplayOrder($displayOrder);
            ++$displayOrder;
        }
    }
public function movePageDisplayOrderToSibling ( Page $ c , $ position = 'before' ) { $ myCID = $ this -> getCollectionPointerOriginalID ( ) ? : $ this -> getCollectionID ( ) ; $ relatedCID = $ c -> getCollectionPointerOriginalID ( ) ? : $ c -> getCollectionID ( ) ; $ pageIDs = [ ] ; $ db = Database :: connection ( ) ; $ r = $ db -> executeQuery ( 'select cID from Pages where cParentID = ? and cID <> ? order by cDisplayOrder asc' , [ $ this -> getCollectionParentID ( ) , $ myCID ] ) ; while ( ( $ cID = $ r -> fetchColumn ( ) ) !== false ) { if ( $ cID == $ relatedCID && $ position == 'before' ) { $ pageIDs [ ] = $ myCID ; } $ pageIDs [ ] = $ cID ; if ( $ cID == $ relatedCID && $ position == 'after' ) { $ pageIDs [ ] = $ myCID ; } } $ displayOrder = 0 ; foreach ( $ pageIDs as $ cID ) { $ co = self :: getByID ( $ cID ) ; $ co -> updateDisplayOrder ( $ displayOrder ) ; ++ $ displayOrder ; } }
Move this page before of after another page.

@param \Concrete\Core\Page\Page $referencePage The reference page
@param string $position 'before' or 'after'
Move this page before of after another page .