Adds the route entry of a view to the collection.
\Symfony\Component\Routing\RouteCollection $collection: A collection of routes that should be registered for this resource.
Overrides PathPluginBase::collectRoutes
public function collectRoutes(RouteCollection $collection) {
parent::collectRoutes($collection);
$style_plugin = $this
->getPlugin('style');
// REST exports should only respond to get methods.
$requirements = array(
'_method' => 'GET',
);
// Format as a string using pipes as a delimeter.
$requirements['_format'] = implode('|', $style_plugin
->getFormats());
// Add the new requirements to each route.
foreach ($collection as $route) {
$route
->addRequirements($requirements);
}
}