protected function ContextUploader::uploadContextBody in TMGMT Translator Smartling 8.2
Same name and namespace in other branches
- 8.4 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::uploadContextBody()
- 8 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::uploadContextBody()
- 8.3 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::uploadContextBody()
Parameters
$url:
$file:
$proj_settings:
Return value
array
1 call to ContextUploader::uploadContextBody()
- ContextUploader::upload in src/
Context/ ContextUploader.php
File
- src/
Context/ ContextUploader.php, line 142
Class
Namespace
Drupal\tmgmt_smartling\ContextCode
protected function uploadContextBody($url, $file, $proj_settings) {
try {
$stream_wrapper_manager = \Drupal::service('stream_wrapper_manager')
->getViaUri($file
->getFileUri());
$params = new UploadContextParameters();
$params
->setContextFileUri($stream_wrapper_manager
->realpath());
$params
->setName($url);
$api = $this
->getApi($proj_settings, 'context');
$response = $api
->uploadAndMatchContext($params);
} catch (Exception $e) {
$response = [];
watchdog_exception('tmgmt_smartling', $e);
}
return $response;
}