public function submit($postContent)
    {
        // load current and submitted data
        $existingRepeaterRows = PageBlockRepeaterData::loadRepeaterData($postContent['repeater_id'], $this->_block->getVersionId());
        $submittedRepeaterRows = Request::input('repeater.' . $postContent['repeater_id']) ?: [];

        // save repeater id, if duplicating get new repeater id to save data to
        $postContent['repeater_id'] = static::$_duplicate ? PageBlockRepeaterRows::nextFreeRepeaterId() : $postContent['repeater_id'];
        $return = $this->save($postContent['repeater_id']);

        // if row missing, overwrite all data with blanks in new version
        if ($existingRepeaterRows && !static::$_duplicate) {
            foreach ($existingRepeaterRows as $rowId => $existingRepeaterRow) {
                if (empty($submittedRepeaterRows[$rowId])) {
                    foreach ($existingRepeaterRow as $blockId => $existingRepeaterBlockContent) {
                        $block = Block::preloadClone($blockId);
                        $block->id = $blockId;
                        if ($block->exists || $blockId === 0) {
                            $block->setVersionId($this->_block->getVersionId())->setRepeaterData($postContent['repeater_id'], $rowId)->setPageId($this->_block->getPageId())->getTypeObject()->save('');
                        }
                    }
                }
            }
        }

        // save new data
        $rowOrderNumber = 0;
        foreach ($submittedRepeaterRows as $rowId => $submittedRepeaterRow) {
            $rowOrderNumber++;
            foreach ($submittedRepeaterRow as $submittedBlockId => $submittedBlockData) {
                $block = Block::preloadClone($submittedBlockId)->setVersionId($this->_block->getVersionId())->setRepeaterData($postContent['repeater_id'], $rowId)->setPageId($this->_block->getPageId());
                if ($submittedBlockId == 0) { // use block id 0 to save order value
                    $block->exists = true;
                    $submittedBlockData = $rowOrderNumber;
                }
                if ($block->exists) {
                    $block->id = $submittedBlockId;
                    $block->getTypeObject()->submit($submittedBlockData);
                }
            }
        }

        return $return;
    }
public function submit($postContent)
    {
        // load current and submitted data
        $existingRepeaterRows = PageBlockRepeaterData::loadRepeaterData($postContent['repeater_id'], $this->_block->getVersionId());
        $submittedRepeaterRows = Request::input('repeater.' . $postContent['repeater_id']) ?: [];

        // save repeater id, if duplicating get new repeater id to save data to
        $postContent['repeater_id'] = static::$_duplicate ? PageBlockRepeaterRows::nextFreeRepeaterId() : $postContent['repeater_id'];
        $return = $this->save($postContent['repeater_id']);

        // if row missing, overwrite all data with blanks in new version
        if ($existingRepeaterRows && !static::$_duplicate) {
            foreach ($existingRepeaterRows as $rowId => $existingRepeaterRow) {
                if (empty($submittedRepeaterRows[$rowId])) {
                    foreach ($existingRepeaterRow as $blockId => $existingRepeaterBlockContent) {
                        $block = Block::preloadClone($blockId);
                        $block->id = $blockId;
                        if ($block->exists || $blockId === 0) {
                            $block->setVersionId($this->_block->getVersionId())->setRepeaterData($postContent['repeater_id'], $rowId)->setPageId($this->_block->getPageId())->getTypeObject()->save('');
                        }
                    }
                }
            }
        }

        // save new data
        $rowOrderNumber = 0;
        foreach ($submittedRepeaterRows as $rowId => $submittedRepeaterRow) {
            $rowOrderNumber++;
            foreach ($submittedRepeaterRow as $submittedBlockId => $submittedBlockData) {
                $block = Block::preloadClone($submittedBlockId)->setVersionId($this->_block->getVersionId())->setRepeaterData($postContent['repeater_id'], $rowId)->setPageId($this->_block->getPageId());
                if ($submittedBlockId == 0) { // use block id 0 to save order value
                    $block->exists = true;
                    $submittedBlockData = $rowOrderNumber;
                }
                if ($block->exists) {
                    $block->id = $submittedBlockId;
                    $block->getTypeObject()->submit($submittedBlockData);
                }
            }
        }

        return $return;
    }
public function submit ( $ postContent ) { // load current and submitted data
 $ existingRepeaterRows = PageBlockRepeaterData :: loadRepeaterData ( $ postContent [ 'repeater_id' ] , $ this -> _block -> getVersionId ( ) ) ; $ submittedRepeaterRows = Request :: input ( 'repeater.' . $ postContent [ 'repeater_id' ] ) ? : [ ] ; // save repeater id, if duplicating get new repeater id to save data to
 $ postContent [ 'repeater_id' ] = static :: $ _duplicate ? PageBlockRepeaterRows :: nextFreeRepeaterId ( ) : $ postContent [ 'repeater_id' ] ; $ return = $ this -> save ( $ postContent [ 'repeater_id' ] ) ; // if row missing, overwrite all data with blanks in new version
 if ( $ existingRepeaterRows && ! static :: $ _duplicate ) { foreach ( $ existingRepeaterRows as $ rowId => $ existingRepeaterRow ) { if ( empty ( $ submittedRepeaterRows [ $ rowId ] ) ) { foreach ( $ existingRepeaterRow as $ blockId => $ existingRepeaterBlockContent ) { $ block = Block :: preloadClone ( $ blockId ) ; $ block -> id = $ blockId ; if ( $ block -> exists || $ blockId === 0 ) { $ block -> setVersionId ( $ this -> _block -> getVersionId ( ) ) -> setRepeaterData ( $ postContent [ 'repeater_id' ] , $ rowId ) -> setPageId ( $ this -> _block -> getPageId ( ) ) -> getTypeObject ( ) -> save ( '' ) ; } } } } } // save new data
 $ rowOrderNumber = 0 ; foreach ( $ submittedRepeaterRows as $ rowId => $ submittedRepeaterRow ) { $ rowOrderNumber ++ ; foreach ( $ submittedRepeaterRow as $ submittedBlockId => $ submittedBlockData ) { $ block = Block :: preloadClone ( $ submittedBlockId ) -> setVersionId ( $ this -> _block -> getVersionId ( ) ) -> setRepeaterData ( $ postContent [ 'repeater_id' ] , $ rowId ) -> setPageId ( $ this -> _block -> getPageId ( ) ) ; if ( $ submittedBlockId == 0 ) { // use block id 0 to save order value
 $ block -> exists = true ; $ submittedBlockData = $ rowOrderNumber ; } if ( $ block -> exists ) { $ block -> id = $ submittedBlockId ; $ block -> getTypeObject ( ) -> submit ( $ submittedBlockData ) ; } } } return $ return ; }
Save submitted repeater data
@param array $postContent
@return static
Save submitted repeater data