protected function TmgmtExtensionSuitTestBase::requestBulkTranslation in TMGMT Extension Suite 8.2
Same name and namespace in other branches
- 8.3 tests/src/Functional/TmgmtExtensionSuitTestBase.php \Drupal\Tests\tmgmt_extension_suit\Functional\TmgmtExtensionSuitTestBase::requestBulkTranslation()
Requests nodes for translation in a batch.
Parameters
array $nids:
array $targetLanguages:
$provider:
array $settings:
Throws
\Exception
File
- tests/
src/ Functional/ TmgmtExtensionSuitTestBase.php, line 112
Class
- TmgmtExtensionSuitTestBase
- Basic class for tmgmt extension module.
Namespace
Drupal\Tests\tmgmt_extension_suit\FunctionalCode
protected function requestBulkTranslation(array $nids, array $targetLanguages, $provider = 'local', array $settings = []) {
// Request nodes for translation.
$data = [];
foreach ($nids as $nid) {
$data["items[{$nid}]"] = "item[{$nid}]";
}
$this
->drupalPostForm('admin/tmgmt/sources', $data, t('Request translation in a batch'));
if (!empty($targetLanguages)) {
$new_data = [];
foreach ($targetLanguages as $targetLanguage) {
$new_data["target_language[{$targetLanguage}]"] = $targetLanguage;
}
$new_data['translator'] = $provider;
foreach ($settings as $setting => $value) {
$new_data[$setting] = $value;
}
$this
->drupalPostForm(NULL, $new_data, t('Request translation'));
}
}