Issue #2011832 by linclark: Change structure of REST config.
parent
03d3cb0a36
commit
7f2133b487
|
@ -75,7 +75,7 @@ class RouteSubscriber implements EventSubscriberInterface {
|
|||
// If there is no format requirement or if it matches the
|
||||
// configuration also add the route.
|
||||
$format_requirement = $route->getRequirement('_format');
|
||||
if (!$format_requirement || isset($enabled_methods[$method][$format_requirement])) {
|
||||
if (!$format_requirement || empty($enabled_methods[$method]['supported_formats']) || in_array($format_requirement, $enabled_methods[$method]['supported_formats'])) {
|
||||
$collection->add("rest.$name", $route);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@ class RequestHandler extends ContainerAware {
|
|||
// format. If the serializer cannot handle it an exception will be thrown
|
||||
// that bubbles up to the client.
|
||||
$config = $this->container->get('config.factory')->get('rest.settings')->get('resources');
|
||||
$enabled_formats = $config[$plugin][$request->getMethod()];
|
||||
if (empty($enabled_formats) || isset($enabled_formats[$format])) {
|
||||
$method_settings = $config[$plugin][$request->getMethod()];
|
||||
if (empty($method_settings['supported_formats']) || in_array($format, $method_settings['supported_formats'])) {
|
||||
$definition = $resource->getPluginDefinition();
|
||||
$class = $definition['serialization_class'];
|
||||
try {
|
||||
|
|
|
@ -195,7 +195,7 @@ abstract class RESTTestBase extends WebTestBase {
|
|||
$settings = array();
|
||||
if ($resource_type) {
|
||||
if ($format) {
|
||||
$settings[$resource_type][$method][$format] = 'TRUE';
|
||||
$settings[$resource_type][$method]['supported_formats'][] = $format;
|
||||
}
|
||||
else {
|
||||
$settings[$resource_type][$method] = array();
|
||||
|
|
Loading…
Reference in New Issue