mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-28 04:56:13 +00:00
Feature: Force language when converting documents
This commit is contained in:
parent
4a30f310b8
commit
d1bdf41c4c
@ -18,6 +18,7 @@ use Chill\MainBundle\Entity\User;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Mime\Part\DataPart;
|
||||
@ -40,6 +41,8 @@ class Convert
|
||||
|
||||
private LoggerInterface $logger;
|
||||
|
||||
private RequestStack $requestStack;
|
||||
|
||||
private Security $security;
|
||||
|
||||
private StoredObjectManagerInterface $storedObjectManager;
|
||||
@ -49,12 +52,14 @@ class Convert
|
||||
*/
|
||||
public function __construct(
|
||||
HttpClientInterface $httpClient,
|
||||
RequestStack $requestStack,
|
||||
Security $security,
|
||||
StoredObjectManagerInterface $storedObjectManager,
|
||||
LoggerInterface $logger,
|
||||
ParameterBagInterface $parameters
|
||||
) {
|
||||
$this->httpClient = $httpClient;
|
||||
$this->requestStack = $requestStack;
|
||||
$this->security = $security;
|
||||
$this->storedObjectManager = $storedObjectManager;
|
||||
$this->logger = $logger;
|
||||
@ -68,6 +73,10 @@ class Convert
|
||||
}
|
||||
|
||||
$content = $this->storedObjectManager->read($storedObject);
|
||||
$query = [];
|
||||
if (null !== $request = $this->requestStack->getCurrentRequest()) {
|
||||
$query['lang'] = $request->getLocale();
|
||||
}
|
||||
|
||||
try {
|
||||
$url = sprintf('%s/cool/convert-to/pdf', $this->collaboraDomain);
|
||||
@ -76,6 +85,7 @@ class Convert
|
||||
]);
|
||||
$response = $this->httpClient->request('POST', $url, [
|
||||
'headers' => $form->getPreparedHeaders()->toArray(),
|
||||
'query' => $query,
|
||||
'body' => $form->bodyToString(),
|
||||
'timeout' => 10,
|
||||
]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user