protected function _reorder()
    {
        if (!empty($this->request->data['regions'])) {
            foreach ($this->request->data['regions'] as $theme => $regions) {
                foreach ($regions as $region => $ids) {
                    $ordering = 0;
                    foreach ($ids as $id) {
                        $blockRegion = $this->Blocks
                            ->BlockRegions
                            ->newEntity([
                                'id' => $id,
                                'theme' => $theme,
                                'region' => $region,
                                'ordering' => $ordering
                            ]);
                        $blockRegion->isNew(false);
                        $this->Blocks->BlockRegions->save($blockRegion);
                        $ordering++;
                    }
                }
            }

            return true;
        }

        return false;
    }
protected function _reorder()
    {
        if (!empty($this->request->data['regions'])) {
            foreach ($this->request->data['regions'] as $theme => $regions) {
                foreach ($regions as $region => $ids) {
                    $ordering = 0;
                    foreach ($ids as $id) {
                        $blockRegion = $this->Blocks
                            ->BlockRegions
                            ->newEntity([
                                'id' => $id,
                                'theme' => $theme,
                                'region' => $region,
                                'ordering' => $ordering
                            ]);
                        $blockRegion->isNew(false);
                        $this->Blocks->BlockRegions->save($blockRegion);
                        $ordering++;
                    }
                }
            }

            return true;
        }

        return false;
    }
protected function _reorder ( ) { if ( ! empty ( $ this -> request -> data [ 'regions' ] ) ) { foreach ( $ this -> request -> data [ 'regions' ] as $ theme => $ regions ) { foreach ( $ regions as $ region => $ ids ) { $ ordering = 0 ; foreach ( $ ids as $ id ) { $ blockRegion = $ this -> Blocks -> BlockRegions -> newEntity ( [ 'id' => $ id , 'theme' => $ theme , 'region' => $ region , 'ordering' => $ ordering ] ) ; $ blockRegion -> isNew ( false ) ; $ this -> Blocks -> BlockRegions -> save ( $ blockRegion ) ; $ ordering ++ ; } } } return true ; } return false ; }
Reorders blocks based on the order provided via POST.

@return bool True on success, false otherwise
Reorders blocks based on the order provided via POST .