function PathProcessorSessions::processInbound
Same name in other branches
- 3.x modules/stream_wrapper_example/src/PathProcessor/PathProcessorSessions.php \Drupal\stream_wrapper_example\PathProcessor\PathProcessorSessions::processInbound()
- 8.x-1.x stream_wrapper_example/src/PathProcessor/PathProcessorSessions.php \Drupal\stream_wrapper_example\PathProcessor\PathProcessorSessions::processInbound()
File
-
modules/
stream_wrapper_example/ src/ PathProcessor/ PathProcessorSessions.php, line 20
Class
- PathProcessorSessions
- Defines a path processor to rewrite file URLs.
Namespace
Drupal\stream_wrapper_example\PathProcessorCode
public function processInbound($path, Request $request) {
if (strpos($path, '/examples/stream_wrapper_example/files/') === 0 && !$request->query
->has('file')) {
$file_path = preg_replace('|^\\/examples\\/stream_wrapper_example\\/files\\/|', '', $path);
$request->query
->set('file', $file_path);
// We return the route we want to match.
return '/examples/stream_wrapper_example/files';
}
return $path;
}