src/GridFieldRestoreAction.php
public function getRestoreAction($gridField, $record, $columnName)
    {
        $canRestoreToDraft = $record->canRestoreToDraft();

        if ($canRestoreToDraft) {
            $restoreToRoot = RestoreAction::shouldRestoreToRoot($record);

            $title = $restoreToRoot
                ? _t('SilverStripe\\Versioned\\RestoreAction.RESTORE_TO_ROOT', 'Restore to draft at top level')
                : _t('SilverStripe\\Versioned\\RestoreAction.RESTORE', 'Restore to draft');
            $description = $restoreToRoot
                ? _t('SilverStripe\\Versioned\\RestoreAction.RESTORE_TO_ROOT_DESC', 'Restore the archived version to draft as a top level item')
                : _t('SilverStripe\\Versioned\\RestoreAction.RESTORE_DESC', 'Restore the archived version to draft');

            $field = GridField_FormAction::create(
                $gridField,
                'Restore' . $record->ID,
                false,
                "restore",
                ['RecordID' => $record->ID]
            )
                ->addExtraClass('btn btn--no-text btn--icon-md font-icon-back-in-time grid-field__icon-action action-menu--handled action-restore')
                ->setAttribute('classNames', 'font-icon-back-in-time action-restore')
                ->setAttribute('data-to-root', $restoreToRoot)
                ->setDescription($description)
                ->setAttribute('aria-label', $title);
        }

        return isset($field) ? $field : null;
    }
public function getRestoreAction($gridField, $record, $columnName)
    {
        $canRestoreToDraft = $record->canRestoreToDraft();

        if ($canRestoreToDraft) {
            $restoreToRoot = RestoreAction::shouldRestoreToRoot($record);

            $title = $restoreToRoot
                ? _t('SilverStripe\\Versioned\\RestoreAction.RESTORE_TO_ROOT', 'Restore to draft at top level')
                : _t('SilverStripe\\Versioned\\RestoreAction.RESTORE', 'Restore to draft');
            $description = $restoreToRoot
                ? _t('SilverStripe\\Versioned\\RestoreAction.RESTORE_TO_ROOT_DESC', 'Restore the archived version to draft as a top level item')
                : _t('SilverStripe\\Versioned\\RestoreAction.RESTORE_DESC', 'Restore the archived version to draft');

            $field = GridField_FormAction::create(
                $gridField,
                'Restore' . $record->ID,
                false,
                "restore",
                ['RecordID' => $record->ID]
            )
                ->addExtraClass('btn btn--no-text btn--icon-md font-icon-back-in-time grid-field__icon-action action-menu--handled action-restore')
                ->setAttribute('classNames', 'font-icon-back-in-time action-restore')
                ->setAttribute('data-to-root', $restoreToRoot)
                ->setDescription($description)
                ->setAttribute('aria-label', $title);
        }

        return isset($field) ? $field : null;
    }
public function getRestoreAction ( $ gridField , $ record , $ columnName ) { $ canRestoreToDraft = $ record -> canRestoreToDraft ( ) ; if ( $ canRestoreToDraft ) { $ restoreToRoot = RestoreAction :: shouldRestoreToRoot ( $ record ) ; $ title = $ restoreToRoot ? _t ( 'SilverStripe\\Versioned\\RestoreAction.RESTORE_TO_ROOT' , 'Restore to draft at top level' ) : _t ( 'SilverStripe\\Versioned\\RestoreAction.RESTORE' , 'Restore to draft' ) ; $ description = $ restoreToRoot ? _t ( 'SilverStripe\\Versioned\\RestoreAction.RESTORE_TO_ROOT_DESC' , 'Restore the archived version to draft as a top level item' ) : _t ( 'SilverStripe\\Versioned\\RestoreAction.RESTORE_DESC' , 'Restore the archived version to draft' ) ; $ field = GridField_FormAction :: create ( $ gridField , 'Restore' . $ record -> ID , false , "restore" , [ 'RecordID' => $ record -> ID ] ) -> addExtraClass ( 'btn btn--no-text btn--icon-md font-icon-back-in-time grid-field__icon-action action-menu--handled action-restore' ) -> setAttribute ( 'classNames' , 'font-icon-back-in-time action-restore' ) -> setAttribute ( 'data-to-root' , $ restoreToRoot ) -> setDescription ( $ description ) -> setAttribute ( 'aria-label' , $ title ) ; } return isset ( $ field ) ? $ field : null ; }
Creates a restore action if the action is able to be preformed

@param GridField $gridField
@param DataObject $record
@param string $columnName
@return GridField_FormAction|null
Creates a restore action if the action is able to be preformed