public function TextimageRoutes::routes in Textimage 8.4
Same name and namespace in other branches
- 8.3 src/Routing/TextimageRoutes.php \Drupal\textimage\Routing\TextimageRoutes::routes()
Returns an array of route objects.
Return value
\Symfony\Component\Routing\Route[] An array of route objects.
1 string reference to 'TextimageRoutes::routes'
File
- src/
Routing/ TextimageRoutes.php, line 47
Class
- TextimageRoutes
- Defines a route for serving Textimages through the URL.
Namespace
Drupal\textimage\RoutingCode
public function routes() {
$routes = [];
// Route for generation of textimages from URL.
$stream_wrapper = $this->streamWrapperManager
->getViaScheme('public');
if (method_exists($stream_wrapper, 'getDirectoryPath')) {
// Route for direct URL Textimage generation.
// If the textimage derivative does not exist, Drupal will create it
// via TextimageDownloadController::urlDeliver.
// If the textimage derivative already exists, the web server will
// deliver it directly.
$routes['textimage.public'] = new Route('/' . $stream_wrapper
->getDirectoryPath() . '/textimage/{image_style}', [
'_controller' => 'Drupal\\textimage\\Controller\\TextimageDownloadController::urlDeliver',
'_disable_route_normalizer' => TRUE,
], [
'_permission' => 'generate textimage url derivatives',
]);
// Route for deferred generation in public scheme.
// If the textimage derivative does not exist, Drupal will create it
// via TextimageDownloadController::deferredDelivery.
// If the textimage derivative already exists, the web server will
// deliver it directly.
$routes['textimage_store.public'] = new Route('/' . $stream_wrapper
->getDirectoryPath() . '/textimage_store', [
'_controller' => 'Drupal\\textimage\\Controller\\TextimageDownloadController::deferredDelivery',
'_disable_route_normalizer' => TRUE,
], [
'_access' => 'TRUE',
]);
}
if ($this->streamWrapperManager
->getViaScheme('private')) {
// Route for deferred generation in private scheme.
// If the textimage derivative does not exist, Drupal will create it
// via TextimageDownloadController::deferredDelivery.
// If the textimage derivative already exists, Drupal will
// deliver it via file_download.
$routes['textimage_store.private'] = new Route('/system/files/textimage_store', [
'_controller' => 'Drupal\\textimage\\Controller\\TextimageDownloadController::deferredDelivery',
'_disable_route_normalizer' => TRUE,
], [
'_access' => 'TRUE',
]);
}
return $routes;
}