concrete/src/Page/Page.php
public function processArrangement($area_id, $moved_block_id, $block_order)
    {
        $area_handle = Area::getAreaHandleFromID($area_id);
        $db = Database::connection();

        // Remove the moved block from its old area, and all blocks from the destination area.
        $db->executeQuery('UPDATE CollectionVersionBlockStyles SET arHandle = ?  WHERE cID = ? and cvID = ? and bID = ?',
                     [$area_handle, $this->getCollectionID(), $this->getVersionID(), $moved_block_id]);
        $db->executeQuery('UPDATE CollectionVersionBlocks SET arHandle = ?  WHERE cID = ? and cvID = ? and bID = ?',
                     [$area_handle, $this->getCollectionID(), $this->getVersionID(), $moved_block_id]);

        $update_query = 'UPDATE CollectionVersionBlocks SET cbDisplayOrder = CASE bID';
        $when_statements = [];
        $update_values = [];
        foreach ($block_order as $key => $block_id) {
            $when_statements[] = 'WHEN ? THEN ?';
            $update_values[] = $block_id;
            $update_values[] = $key;
        }

        $update_query .= ' '.implode(' ', $when_statements).' END WHERE bID in ('.
            implode(',', array_pad([], count($block_order), '?')).') AND cID = ? AND cvID = ?';
        $values = array_merge($update_values, $block_order);
        $values = array_merge($values, [$this->getCollectionID(), $this->getVersionID()]);

        $db->executeQuery($update_query, $values);
    }
public function processArrangement($area_id, $moved_block_id, $block_order)
    {
        $area_handle = Area::getAreaHandleFromID($area_id);
        $db = Database::connection();

        // Remove the moved block from its old area, and all blocks from the destination area.
        $db->executeQuery('UPDATE CollectionVersionBlockStyles SET arHandle = ?  WHERE cID = ? and cvID = ? and bID = ?',
                     [$area_handle, $this->getCollectionID(), $this->getVersionID(), $moved_block_id]);
        $db->executeQuery('UPDATE CollectionVersionBlocks SET arHandle = ?  WHERE cID = ? and cvID = ? and bID = ?',
                     [$area_handle, $this->getCollectionID(), $this->getVersionID(), $moved_block_id]);

        $update_query = 'UPDATE CollectionVersionBlocks SET cbDisplayOrder = CASE bID';
        $when_statements = [];
        $update_values = [];
        foreach ($block_order as $key => $block_id) {
            $when_statements[] = 'WHEN ? THEN ?';
            $update_values[] = $block_id;
            $update_values[] = $key;
        }

        $update_query .= ' '.implode(' ', $when_statements).' END WHERE bID in ('.
            implode(',', array_pad([], count($block_order), '?')).') AND cID = ? AND cvID = ?';
        $values = array_merge($update_values, $block_order);
        $values = array_merge($values, [$this->getCollectionID(), $this->getVersionID()]);

        $db->executeQuery($update_query, $values);
    }
public function processArrangement ( $ area_id , $ moved_block_id , $ block_order ) { $ area_handle = Area :: getAreaHandleFromID ( $ area_id ) ; $ db = Database :: connection ( ) ; // Remove the moved block from its old area, and all blocks from the destination area. $ db -> executeQuery ( 'UPDATE CollectionVersionBlockStyles SET arHandle = ?  WHERE cID = ? and cvID = ? and bID = ?' , [ $ area_handle , $ this -> getCollectionID ( ) , $ this -> getVersionID ( ) , $ moved_block_id ] ) ; $ db -> executeQuery ( 'UPDATE CollectionVersionBlocks SET arHandle = ?  WHERE cID = ? and cvID = ? and bID = ?' , [ $ area_handle , $ this -> getCollectionID ( ) , $ this -> getVersionID ( ) , $ moved_block_id ] ) ; $ update_query = 'UPDATE CollectionVersionBlocks SET cbDisplayOrder = CASE bID' ; $ when_statements = [ ] ; $ update_values = [ ] ; foreach ( $ block_order as $ key => $ block_id ) { $ when_statements [ ] = 'WHEN ? THEN ?' ; $ update_values [ ] = $ block_id ; $ update_values [ ] = $ key ; } $ update_query .= ' ' . implode ( ' ' , $ when_statements ) . ' END WHERE bID in (' . implode ( ',' , array_pad ( [ ] , count ( $ block_order ) , '?' ) ) . ') AND cID = ? AND cvID = ?' ; $ values = array_merge ( $ update_values , $ block_order ) ; $ values = array_merge ( $ values , [ $ this -> getCollectionID ( ) , $ this -> getVersionID ( ) ] ) ; $ db -> executeQuery ( $ update_query , $ values ) ; }
Persist the data associated to a block when it has been moved around in the page.

@param int $area_id The ID of the area where the block resides after the arrangment
@param int $moved_block_id The ID of the moved block
@param int[] $block_order The IDs of all the blocks in the area, ordered by their display order
Persist the data associated to a block when it has been moved around in the page .