silverstripe-cms/code/BatchActions/CMSBatchAction_Publish.php
2017-05-08 17:57:24 +12:00

32 lines
685 B
PHP

<?php
namespace SilverStripe\CMS\BatchActions;
use SilverStripe\Admin\CMSBatchAction;
use SilverStripe\ORM\SS_List;
/**
* Publish items batch action.
*/
class CMSBatchAction_Publish extends CMSBatchAction
{
public function getActionTitle()
{
return _t(__CLASS__.'.PUBLISH_PAGES', 'Publish');
}
public function run(SS_List $pages)
{
return $this->batchaction(
$pages,
'publishRecursive',
_t(__CLASS__.'.PUBLISHED_PAGES', 'Published %d pages, %d failures')
);
}
public function applicablePages($ids)
{
return $this->applicablePagesHelper($ids, 'canPublish', true, false);
}
}