src/VersionedGridFieldItemRequest.php
public function doUnpublish($data, $form)
    {
        /** @var Versioned|DataObject $record */
        $record = $this->getRecord();
        if (!$record->canUnpublish()) {
            return $this->httpError(403);
        }

        // Record name before it's deleted
        $title = $record->Title;
        $record->doUnpublish();

        $message = _t(
            __CLASS__ . '.Unpublished',
            'Unpublished {name} {title}',
            [
                'name' => $record->i18n_singular_name(),
                'title' => Convert::raw2xml($title)
            ]
        );
        $this->setFormMessage($form, $message);

        // Redirect back to edit
        return $this->redirectAfterSave(false);
    }
public function doUnpublish($data, $form)
    {
        /** @var Versioned|DataObject $record */
        $record = $this->getRecord();
        if (!$record->canUnpublish()) {
            return $this->httpError(403);
        }

        // Record name before it's deleted
        $title = $record->Title;
        $record->doUnpublish();

        $message = _t(
            __CLASS__ . '.Unpublished',
            'Unpublished {name} {title}',
            [
                'name' => $record->i18n_singular_name(),
                'title' => Convert::raw2xml($title)
            ]
        );
        $this->setFormMessage($form, $message);

        // Redirect back to edit
        return $this->redirectAfterSave(false);
    }
public function doUnpublish ( $ data , $ form ) { /** @var Versioned|DataObject $record */ $ record = $ this -> getRecord ( ) ; if ( ! $ record -> canUnpublish ( ) ) { return $ this -> httpError ( 403 ) ; } // Record name before it's deleted $ title = $ record -> Title ; $ record -> doUnpublish ( ) ; $ message = _t ( __CLASS__ . '.Unpublished' , 'Unpublished {name} {title}' , [ 'name' => $ record -> i18n_singular_name ( ) , 'title' => Convert :: raw2xml ( $ title ) ] ) ; $ this -> setFormMessage ( $ form , $ message ) ; // Redirect back to edit return $ this -> redirectAfterSave ( false ) ; }
Delete this record from the live site

@param array $data
@param Form $form
@return HTTPResponse
Delete this record from the live site