public function doDelete($data, Form $form) {
        $record=$this->currentPage();
    
        if($record->canDelete()) {
            Session::set('CodeBank.deletedSnippetID', $record->ID);
            $record->delete();
    
            $this->response->addHeader('X-Status', rawurlencode(_t('CodeBank.SNIPPET_DELETED', '_Snippet has been deleted')));
        }else {
            $this->response->addHeader('X-Status', rawurlencode(_t('CodeBank.PERMISSION_DENIED', '_Permission Denied')));
        }
        
        $this->redirect('admin/codeBank/');
        return $this->getResponseNegotiator()->respond($this->request);
    }
public function doDelete($data, Form $form) {
        $record=$this->currentPage();
    
        if($record->canDelete()) {
            Session::set('CodeBank.deletedSnippetID', $record->ID);
            $record->delete();
    
            $this->response->addHeader('X-Status', rawurlencode(_t('CodeBank.SNIPPET_DELETED', '_Snippet has been deleted')));
        }else {
            $this->response->addHeader('X-Status', rawurlencode(_t('CodeBank.PERMISSION_DENIED', '_Permission Denied')));
        }
        
        $this->redirect('admin/codeBank/');
        return $this->getResponseNegotiator()->respond($this->request);
    }
public function doDelete ( $ data , Form $ form ) { $ record = $ this -> currentPage ( ) ; if ( $ record -> canDelete ( ) ) { Session :: set ( 'CodeBank.deletedSnippetID' , $ record -> ID ) ; $ record -> delete ( ) ; $ this -> response -> addHeader ( 'X-Status' , rawurlencode ( _t ( 'CodeBank.SNIPPET_DELETED' , '_Snippet has been deleted' ) ) ) ; } else { $ this -> response -> addHeader ( 'X-Status' , rawurlencode ( _t ( 'CodeBank.PERMISSION_DENIED' , '_Permission Denied' ) ) ) ; } $ this -> redirect ( 'admin/codeBank/' ) ; return $ this -> getResponseNegotiator ( ) -> respond ( $ this -> request ) ; }
Deletes the snippet from the database
@param {array} $data Data submitted by the user
@param {Form} $form Submitting form
@return {SS_HTTPResponse} Response
Deletes the snippet from the database