Last active
June 9, 2016 00:04
-
-
Save thezenmonkey/36f1f6892efc08969712d68d3c5240f0 to your computer and use it in GitHub Desktop.
Silverstripe CMS Batch Action to Create Translations for Translatable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CMSBatchActions_TranslateTo extends CMSBatchAction { | |
public function getActionTitle() { | |
return _t('CMSBatchActions.TRANSLATETO', 'Translate to...'); | |
} | |
public function run(SS_List $pages) { | |
$status = array( | |
'modified'=>array() | |
); | |
foreach($pages as $page) { | |
$id = $page->ID; | |
$status['modified'][$id] = array( | |
'TreeTitle' => $page->TreeTitle | |
); | |
} | |
return $this->response(_t('CMSBatchActions.Translated', 'Translation Create'), $status); | |
} | |
public function applicablePages($ids) { | |
return $this->applicablePagesHelper($ids, 'canEdit', false, true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment