Remove customizations to resource types
See #3105318: Add a public API for aliasing resource type names for the issue that allows renaming resource types.
The Commerce API module renames all Commerce ecosystem entities to remove the commerce_ prefix and pluralize the entity type's name.
The commerce_api.resource_type_build_subscriber service customizes all entity types that have the commerce_ prefix. To remove these customizations and use the normal JSON:API resource type naming from Drupal core, use the following instructions.
Create a service provider to alter the service definitions. Remove the commerce_api.resource_type_build_subscriber service from the service container's definitions.
<?php
namespace Drupal\my_module;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;
class MyModuleServiceProvider extends ServiceProviderBase {
public function alter(ContainerBuilder $container) {
$container->removeDefinition('commerce_api.resource_type_build_subscriber');
}
}You'll now have normal Drupal core behavior, such as /jsonapi/commerce_product/default versus /jsonapi/products/default.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion