silverstripe-cms/code/BatchActions/CMSBatchAction_Archive.php

35 lines
904 B
PHP
Raw Permalink Normal View History

<?php
namespace SilverStripe\CMS\BatchActions;
use SilverStripe\ORM\SS_List;
use SilverStripe\Admin\CMSBatchAction;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Dev\Deprecation;
/**
* Delete items batch action.
*/
2017-01-25 21:59:25 +01:00
class CMSBatchAction_Archive extends CMSBatchAction
{
public function getActionTitle()
{
return _t(__CLASS__ . '.TITLE', 'Unpublish and archive');
2017-01-25 21:59:25 +01:00
}
public function run(SS_List $pages): HTTPResponse
2017-01-25 21:59:25 +01:00
{
return $this->batchaction(
$pages,
'doArchive',
_t(__CLASS__ . '.RESULT', 'Deleted %d pages from draft and live, and sent them to the archive')
2017-01-25 21:59:25 +01:00
);
}
2017-01-25 21:59:25 +01:00
public function applicablePages($ids)
{
// canArchive() is deprecated, not $this->applicablePagesHelper()
return Deprecation::withSuppressedNotice(fn() => $this->applicablePagesHelper($ids, 'canArchive'));
2017-01-25 21:59:25 +01:00
}
}