public function restore($data, $form)
    {
        if (!isset($data['ID']) || !is_numeric($data['ID'])) {
            return new HTTPResponse("Please pass an ID in the form content", 400);
        }

        $id = (int)$data['ID'];
        /** @var SiteTree $restoredPage */
        $restoredPage = Versioned::get_latest_version(SiteTree::class, $id);
        if (!$restoredPage) {
            return new HTTPResponse("SiteTree #$id not found", 400);
        }

        $restoredPage = $restoredPage->doRestoreToStage();

        $this->getResponse()->addHeader(
            'X-Status',
            rawurlencode(_t(
                __CLASS__ . '.RESTORED',
                "Restored '{title}' successfully",
                array('title' => $restoredPage->Title)
            ))
        );

        return $this->getResponseNegotiator()->respond($this->getRequest());
    }
public function restore($data, $form)
    {
        if (!isset($data['ID']) || !is_numeric($data['ID'])) {
            return new HTTPResponse("Please pass an ID in the form content", 400);
        }

        $id = (int)$data['ID'];
        /** @var SiteTree $restoredPage */
        $restoredPage = Versioned::get_latest_version(SiteTree::class, $id);
        if (!$restoredPage) {
            return new HTTPResponse("SiteTree #$id not found", 400);
        }

        $restoredPage = $restoredPage->doRestoreToStage();

        $this->getResponse()->addHeader(
            'X-Status',
            rawurlencode(_t(
                __CLASS__ . '.RESTORED',
                "Restored '{title}' successfully",
                array('title' => $restoredPage->Title)
            ))
        );

        return $this->getResponseNegotiator()->respond($this->getRequest());
    }
public function restore ( $ data , $ form ) { if ( ! isset ( $ data [ 'ID' ] ) || ! is_numeric ( $ data [ 'ID' ] ) ) { return new HTTPResponse ( "Please pass an ID in the form content" , 400 ) ; } $ id = ( int ) $ data [ 'ID' ] ; /** @var SiteTree $restoredPage */ $ restoredPage = Versioned :: get_latest_version ( SiteTree :: class , $ id ) ; if ( ! $ restoredPage ) { return new HTTPResponse ( "SiteTree #$id not found" , 400 ) ; } $ restoredPage = $ restoredPage -> doRestoreToStage ( ) ; $ this -> getResponse ( ) -> addHeader ( 'X-Status' , rawurlencode ( _t ( __CLASS__ . '.RESTORED' , "Restored '{title}' successfully" , array ( 'title' => $ restoredPage -> Title ) ) ) ) ; return $ this -> getResponseNegotiator ( ) -> respond ( $ this -> getRequest ( ) ) ; }
Restore a completely deleted page from the SiteTree_versions table.

@param array $data
@param Form $form
@return HTTPResponse
Restore a completely deleted page from the SiteTree_versions table .