protected function Redirect::getPath in File (Field) Paths 8
Returns the path to the file, starting from the Drupal root.
Parameters
string $file_uri: The file url to get the path for.
Return value
string|null The file path, if found. Null otherwise.
1 call to Redirect::getPath()
- Redirect::createRedirect in src/
Redirect.php - Creates a redirect for a moved File field.
File
- src/
Redirect.php, line 101
Class
- Redirect
- Service for creating file redirects.
Namespace
Drupal\filefield_pathsCode
protected function getPath($file_uri) {
if ($wrapper = $this->streamWrapperManager
->getViaUri($file_uri)) {
$directory = $wrapper
->getDirectoryPath();
$target = StreamWrapperManager::getTarget($file_uri);
return $directory . DIRECTORY_SEPARATOR . $target;
}
}