2016-08-11 04:10:51 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\CMS\BatchActions;
|
|
|
|
|
2024-09-23 04:37:02 +02:00
|
|
|
use SilverStripe\Model\List\SS_List;
|
2016-10-25 02:22:31 +02:00
|
|
|
use SilverStripe\Admin\CMSBatchAction;
|
2022-10-18 07:21:09 +02:00
|
|
|
use SilverStripe\Control\HTTPResponse;
|
2016-08-11 04:10:51 +02:00
|
|
|
|
|
|
|
/**
|
2016-10-25 02:22:31 +02:00
|
|
|
* Delete items batch action.
|
2016-08-11 04:10:51 +02:00
|
|
|
*/
|
2017-01-25 21:59:25 +01:00
|
|
|
class CMSBatchAction_Archive extends CMSBatchAction
|
|
|
|
{
|
|
|
|
public function getActionTitle()
|
|
|
|
{
|
2017-05-19 02:11:46 +02:00
|
|
|
return _t(__CLASS__ . '.TITLE', 'Unpublish and archive');
|
2017-01-25 21:59:25 +01:00
|
|
|
}
|
2016-08-11 04:10:51 +02:00
|
|
|
|
2022-10-18 07:21:09 +02:00
|
|
|
public function run(SS_List $pages): HTTPResponse
|
2017-01-25 21:59:25 +01:00
|
|
|
{
|
|
|
|
return $this->batchaction(
|
|
|
|
$pages,
|
|
|
|
'doArchive',
|
2017-05-19 02:11:46 +02:00
|
|
|
_t(__CLASS__ . '.RESULT', 'Deleted %d pages from draft and live, and sent them to the archive')
|
2017-01-25 21:59:25 +01:00
|
|
|
);
|
|
|
|
}
|
2016-08-11 04:10:51 +02:00
|
|
|
|
2017-01-25 21:59:25 +01:00
|
|
|
public function applicablePages($ids)
|
|
|
|
{
|
2024-08-16 01:30:58 +02:00
|
|
|
return $this->applicablePagesHelper($ids, 'canDelete');
|
2017-01-25 21:59:25 +01:00
|
|
|
}
|
2016-08-11 04:10:51 +02:00
|
|
|
}
|