2

Drupal defines the CoreServiceProvider class which is used to add the twig, twig.loader.filesystem, and module_handler services.

Since the Drupal 8 way to register a service from a module is using the .services.yaml file, is there any case where a class similar to CoreServiceProvider should be used?

1 Answer 1

2

In short, no: The Twig service registration is written by Fabien Potencier himself. Nobody will probably need to write anything as complex as Twig to necessitate this level of complexity in the service registration.
The module handler is just fanciness: An override for the module handler could have been written during install time.

Unless you are writing an install profile which uses a service, you won't face this problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.