eZ\Publish\Core\MVC\Symfony\Controller\Content\DownloadRedirectionController::redirectToContentDownloadAction PHP Method

redirectToContentDownloadAction() public method

It redirects (permanently) to the standard ez_content_download route, based on the language of the field passed as an argument, using the language switcher.
public redirectToContentDownloadAction ( mixed $contentId, integer $fieldId, Request $request ) : RedirectResponse
$contentId mixed
$fieldId integer
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\RedirectResponse
    public function redirectToContentDownloadAction($contentId, $fieldId, Request $request)
    {
        $content = $this->contentService->loadContent($contentId);
        $field = $this->findFieldInContent($fieldId, $content);
        $params = array('content' => $content, 'fieldIdentifier' => $field->fieldDefIdentifier, 'language' => $field->languageCode);
        if ($request->query->has('version')) {
            $params['version'] = $request->query->get('version');
        }
        $downloadUrl = $this->router->generate($this->routeReferenceGenerator->generate('ez_content_download', $params));
        return new RedirectResponse($downloadUrl, 302);
    }