diff --git a/guides/plugins/plugins/checkout/document/add-custom-document-type.md b/guides/plugins/plugins/checkout/document/add-custom-document-type.md index c8d49c6b7..09960dfd6 100644 --- a/guides/plugins/plugins/checkout/document/add-custom-document-type.md +++ b/guides/plugins/plugins/checkout/document/add-custom-document-type.md @@ -341,15 +341,35 @@ Here's what the function does: Depending on the file type we either get the content with `$this->fileRendererRegistry->render()` or we need to create the content on our own. `DocumentFileRendererRegistry` acts as a central registry for document file renderers based on file extensions (e.g., .pdf, .html). It delegates the rendering of documents to the appropriate renderer implementation. -Therefore, for each registered service that extends the `AbstractDocumentTypeRenderer`, the content of the document can be generated. New types of `AbstractDocumentTypeRenderer` services can be added with `document_type.renderer` as the tag name and the file extension as a key. -```xml - - ... - - +### Registering the renderer in the service container + +Now we need to register our custom `ExampleDocumentRenderer` in the service container. Create or update your `services.xml` file: + +::: code-group + +```xml [PLUGIN_ROOT/src/Resources/config/services.xml] + + + + + + + + + + + + + ``` +::: + +Note that we're using the tag `document.renderer` to register our custom document renderer. The tag name matches what was mentioned earlier - your renderer has to be registered using the tag `document.renderer`. + ### Adding a document type template Let's have a quick look at an example document type template. Go ahead and create a new file at the path `/src/Resources/views/documents/example_document.html.twig`.