src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
protected function redirectAfterSave($isNewRecord)
    {
        $controller = $this->getToplevelController();
        if ($isNewRecord) {
            return $controller->redirect($this->Link());
        } elseif ($this->gridField->getList()->byID($this->record->ID)) {
            // Return new view, as we can't do a "virtual redirect" via the CMS Ajax
            // to the same URL (it assumes that its content is already current, and doesn't reload)
            return $this->edit($controller->getRequest());
        } else {
            // Changes to the record properties might've excluded the record from
            // a filtered list, so return back to the main view if it can't be found
            $url = $controller->getRequest()->getURL();
            $noActionURL = $controller->removeAction($url);
            $controller->getRequest()->addHeader('X-Pjax', 'Content');
            return $controller->redirect($noActionURL, 302);
        }
    }
protected function redirectAfterSave($isNewRecord)
    {
        $controller = $this->getToplevelController();
        if ($isNewRecord) {
            return $controller->redirect($this->Link());
        } elseif ($this->gridField->getList()->byID($this->record->ID)) {
            // Return new view, as we can't do a "virtual redirect" via the CMS Ajax
            // to the same URL (it assumes that its content is already current, and doesn't reload)
            return $this->edit($controller->getRequest());
        } else {
            // Changes to the record properties might've excluded the record from
            // a filtered list, so return back to the main view if it can't be found
            $url = $controller->getRequest()->getURL();
            $noActionURL = $controller->removeAction($url);
            $controller->getRequest()->addHeader('X-Pjax', 'Content');
            return $controller->redirect($noActionURL, 302);
        }
    }
protected function redirectAfterSave ( $ isNewRecord ) { $ controller = $ this -> getToplevelController ( ) ; if ( $ isNewRecord ) { return $ controller -> redirect ( $ this -> Link ( ) ) ; } elseif ( $ this -> gridField -> getList ( ) -> byID ( $ this -> record -> ID ) ) { // Return new view, as we can't do a "virtual redirect" via the CMS Ajax // to the same URL (it assumes that its content is already current, and doesn't reload) return $ this -> edit ( $ controller -> getRequest ( ) ) ; } else { // Changes to the record properties might've excluded the record from // a filtered list, so return back to the main view if it can't be found $ url = $ controller -> getRequest ( ) -> getURL ( ) ; $ noActionURL = $ controller -> removeAction ( $ url ) ; $ controller -> getRequest ( ) -> addHeader ( 'X-Pjax' , 'Content' ) ; return $ controller -> redirect ( $ noActionURL , 302 ) ; } }
Response object for this request after a successful save

@param bool $isNewRecord True if this record was just created
@return HTTPResponse|DBHTMLText
Response object for this request after a successful save