Source of file GenerateTranslationTask.php
Size: 0,644 Bytes - Last Modified: 2021-12-24T06:35:26+00:00
/var/www/docs.ssmods.com/process/src/tasks/GenerateTranslationTask.php
12345678910111213141516171819202122232425262728293031323334 | <?php /** * @package cms * @subpackage tasks */ class GenerateTranslationTask extends BuildTask { private static $allowed_actions = array('*' => 'ADMIN'); protected $title = 'Generate translation task'; protected $description = 'Generate a duplicate translation for a Locale from default Locale'; public function run($request) { $locale=Translatable::default_locale(); $pages=SiteTree::get()->where("Locale='{$locale}'"); foreach ($pages as $page) { $translated=$page->createTranslation("en_GB"); $translated->doPublish(); // $page->doUnpublish(); // $page->delete(); } } } |