public function FileUrlRedirect::redirectToFile in File URL 8
Same name and namespace in other branches
- 2.0.x src/Controller/FileUrlRedirect.php \Drupal\file_url\Controller\FileUrlRedirect::redirectToFile()
Redirect to the actual file.
Parameters
\Drupal\file\FileInterface $file: The file object.
Return value
\Symfony\Component\HttpFoundation\RedirectResponse The redirect object.
1 string reference to 'FileUrlRedirect::redirectToFile'
File
- src/
Controller/ FileUrlRedirect.php, line 26
Class
- FileUrlRedirect
- Redirects to the file location.
Namespace
Drupal\file_url\ControllerCode
public function redirectToFile(FileInterface $file) {
$url = $file
->toUrl()
->toString();
return new RedirectResponse($url);
}