public function BackgroundImageRoutes::routes in Background Image 8
Same name and namespace in other branches
- 2.x src/Routing/BackgroundImageRoutes.php \Drupal\background_image\Routing\BackgroundImageRoutes::routes()
- 2.0.x src/Routing/BackgroundImageRoutes.php \Drupal\background_image\Routing\BackgroundImageRoutes::routes()
Returns an array of route objects.
Return value
\Symfony\Component\Routing\Route[] An array of route objects.
1 string reference to 'BackgroundImageRoutes::routes'
File
- src/
Routing/ BackgroundImageRoutes.php, line 47
Class
- BackgroundImageRoutes
- Defines a route subscriber to register a url for serving background image CSS.
Namespace
Drupal\background_image\RoutingCode
public function routes() {
$routes = [];
// Generate background image CSS files. If clean URLs are disabled the
// files will always be served through the menu system. If clean URLs are
// enabled and the file already exists, PHP will be bypassed.
$directory_path = $this->streamWrapperManager
->getViaScheme('public')
->getDirectoryPath();
$routes['background_image.css'] = new Route('/' . $directory_path . '/background_image/css/{background_image}/{scheme}/{file}', [
'_controller' => 'Drupal\\background_image\\Controller\\BackgroundImageCssController::deliver',
], [
'_access' => 'TRUE',
]);
return $routes;
}