Skip to content

Commit

Permalink
Merge pull request #372 from creative-commoners/pulls/1/rescue-master…
Browse files Browse the repository at this point in the history
…-use-class-syntax

Rescue Master Branch Commit ENH Prefer `::class` syntax over class strings
  • Loading branch information
emteknetnz authored Sep 1, 2022
2 parents 1e92ce2 + 1a233ce commit 6ebbc7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/GridFieldRestoreAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ public function getRestoreAction($gridField, $record, $columnName)
$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');
? _t(RestoreAction::class . '.RESTORE_TO_ROOT', 'Restore to draft at top level')
: _t(RestoreAction::class . '.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');
? _t(RestoreAction::class . '.RESTORE_TO_ROOT_DESC', 'Restore the archived version to draft as a top level item')
: _t(RestoreAction::class . '.RESTORE_DESC', 'Restore the archived version to draft');

$field = GridField_FormAction::create(
$gridField,
Expand Down
7 changes: 4 additions & 3 deletions src/VersionedGridFieldItemRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SilverStripe\Versioned;

use SilverStripe\CMS\Controllers\CMSMain;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Core\Convert;
use SilverStripe\Forms\FieldList;
Expand Down Expand Up @@ -323,7 +324,7 @@ protected function addVersionedButtons(DataObject $record, FieldList $actions)
->addExtraClass('btn-outline-primary font-icon-tick')
->setAttribute('data-btn-alternate-add', 'btn-primary font-icon-save')
->setAttribute('data-btn-alternate-remove', 'btn-outline-primary font-icon-tick')
->setAttribute('data-text-alternate', _t('SilverStripe\\CMS\\Controllers\\CMSMain.SAVEDRAFT', 'Save draft'));
->setAttribute('data-text-alternate', _t(CMSMain::class . '.SAVEDRAFT', 'Save draft'));
}

// "publish" action
Expand Down Expand Up @@ -370,8 +371,8 @@ protected function addVersionedButtons(DataObject $record, FieldList $actions)
// Replace "delete" action
$actions->removeByName('action_doDelete');
$title = $isPublished
? _t('SilverStripe\\CMS\\Controllers\\CMSMain.UNPUBLISH_AND_ARCHIVE', 'Unpublish and archive')
: _t('SilverStripe\\CMS\\Controllers\\CMSMain.ARCHIVE', 'Archive');
? _t(CMSMain::class . '.UNPUBLISH_AND_ARCHIVE', 'Unpublish and archive')
: _t(CMSMain::class . '.ARCHIVE', 'Archive');

$actionArchive = FormAction::create('doArchive', $title)
->addExtraClass('delete btn btn-secondary')
Expand Down

0 comments on commit 6ebbc7d

Please sign in to comment.