protected function ContextUploader::uploadContextBody in TMGMT Translator Smartling 8
Same name and namespace in other branches
- 8.4 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::uploadContextBody()
- 8.2 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::uploadContextBody()
- 8.3 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::uploadContextBody()
Parameters
$url:
$html:
$filename:
Return value
array
Throws
EmptyContextParameterException
1 call to ContextUploader::uploadContextBody()
- ContextUploader::upload in src/
Context/ ContextUploader.php
File
- src/
Context/ ContextUploader.php, line 135
Class
Namespace
Drupal\tmgmt_smartling\ContextCode
protected function uploadContextBody($url, $html, $filename, $proj_settings) {
$orgId = $proj_settings['orgID'];
if (empty($orgId)) {
throw new EmptyContextParameterException('OrgId is a mandatory field. Please, fill it in.');
}
$api = $this
->getApi($proj_settings, TRUE);
if (!empty($filename)) {
$response = $api
->uploadContext(array(
'url' => $url,
'html' => $html,
'fileUri' => $filename,
'orgId' => $orgId,
), [
'html' => [
'name' => 'context.html',
'content_type' => 'text/html',
],
]);
}
$response2 = $api
->uploadContext(array(
'url' => $url,
'html' => $html,
'orgId' => $orgId,
), [
'html' => [
'name' => 'context.html',
'content_type' => 'text/html',
],
]);
if (empty($response)) {
$response = $response2;
}
return $response;
}