if ($route =
$collection->
get("view.
$view_id.
$display_id"
)) { $style_plugin =
$this->
getPlugin('style'
);
// REST exports should only respond to GET methods.
$route->
setMethods(['GET'
]);
$formats =
$style_plugin->
getFormats();
// If there are no configured formats, add all formats that serialization
// is known to support.
if (!
$formats) { $formats =
$this->
getFormatOptions();
} // Format as a string using pipes as a delimiter.
$route->
setRequirement('_format',
implode('|',
$formats));
// Add authentication to the route if it was set. If no authentication was
// set, the default authentication will be used, which is cookie based by
// default.
$auth =
$this->
getOption('auth'
);
if (!
empty($auth)) { $route->
setOption('_auth',
$auth);
}