protected function getRoutesForResourceConfig(RestResourceConfigInterface
$rest_resource_config) { $plugin =
$rest_resource_config->
getResourcePlugin();
$collection =
new RouteCollection();
foreach ($plugin->
routes() as $name =>
$route) { /** @var \Symfony\Component\Routing\Route $route */
// @todo: Are multiple methods possible here?
$methods =
$route->
getMethods();
// Only expose routes that have an explicit method and allow >=1 format
// for that method.
if (($methods && ($method =
$methods[0
]) &&
$rest_resource_config->
getFormats($method))) { $route->
setRequirement('_csrf_request_header_token', 'TRUE'
);