src/Extensions/ArchiveRestoreAction.php
public function updateItemEditForm(Form $form)
    {
        $record = $this->owner->getRecord();

        if ($this->shouldDisplayAction($record)) {
            $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'
                );

            $form->actions = FieldList::create(
                FormAction::create('doRestore', $title)
                    ->setDescription($description)
                    ->setAttribute('data-to-root', $restoreToRoot)
                    ->addExtraClass('btn-warning font-icon-back-in-time ArchiveAdmin__action--restore')
                    ->setUseButtonTag(true)
            );

            $form->unsetValidator();
        }
    }
public function updateItemEditForm(Form $form)
    {
        $record = $this->owner->getRecord();

        if ($this->shouldDisplayAction($record)) {
            $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'
                );

            $form->actions = FieldList::create(
                FormAction::create('doRestore', $title)
                    ->setDescription($description)
                    ->setAttribute('data-to-root', $restoreToRoot)
                    ->addExtraClass('btn-warning font-icon-back-in-time ArchiveAdmin__action--restore')
                    ->setUseButtonTag(true)
            );

            $form->unsetValidator();
        }
    }
public function updateItemEditForm ( Form $ form ) { $ record = $ this -> owner -> getRecord ( ) ; if ( $ this -> shouldDisplayAction ( $ record ) ) { $ 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' ) ; $ form -> actions = FieldList :: create ( FormAction :: create ( 'doRestore' , $ title ) -> setDescription ( $ description ) -> setAttribute ( 'data-to-root' , $ restoreToRoot ) -> addExtraClass ( 'btn-warning font-icon-back-in-time ArchiveAdmin__action--restore' ) -> setUseButtonTag ( true ) ) ; $ form -> unsetValidator ( ) ; } }
Updates the edit form with a restore button if it is being viewed

@param Form $form
@return mixed
Updates the edit form with a restore button if it is being viewed