public function sortBlocks( array $sortArray )
    {
        $sortedBlocks = array();

        foreach( $sortArray as $sortItem )
        {
            $blocksToBeRemoved = array();
            
            foreach( $this->attributes['blocks'] as $block )
            {
                if ( $block->attribute('id') === $sortItem )
                    $sortedBlocks[] = $block;
                
                if ( $block->toBeRemoved() )
                    $blocksToBeRemoved[] = $block;
            }
        }

        $sortedBlocks = array_merge( $sortedBlocks, $blocksToBeRemoved );

        $this->attributes['blocks'] = $sortedBlocks;
    }
public function sortBlocks( array $sortArray )
    {
        $sortedBlocks = array();

        foreach( $sortArray as $sortItem )
        {
            $blocksToBeRemoved = array();
            
            foreach( $this->attributes['blocks'] as $block )
            {
                if ( $block->attribute('id') === $sortItem )
                    $sortedBlocks[] = $block;
                
                if ( $block->toBeRemoved() )
                    $blocksToBeRemoved[] = $block;
            }
        }

        $sortedBlocks = array_merge( $sortedBlocks, $blocksToBeRemoved );

        $this->attributes['blocks'] = $sortedBlocks;
    }
public function sortBlocks ( array $ sortArray ) { $ sortedBlocks = array ( ) ; foreach ( $ sortArray as $ sortItem ) { $ blocksToBeRemoved = array ( ) ; foreach ( $ this -> attributes [ 'blocks' ] as $ block ) { if ( $ block -> attribute ( 'id' ) === $ sortItem ) $ sortedBlocks [ ] = $ block ; if ( $ block -> toBeRemoved ( ) ) $ blocksToBeRemoved [ ] = $ block ; } } $ sortedBlocks = array_merge ( $ sortedBlocks , $ blocksToBeRemoved ) ; $ this -> attributes [ 'blocks' ] = $ sortedBlocks ; }
Sorting blocks for given sort array which contains block ids

@param array $sortArray
Sorting blocks for given sort array which contains block ids