Template paths

Attention

Make sure you have defined EXT:handlebars as dependency in your extension(s). Otherwise, template root paths might not be interpreted correctly.

Registration of template root paths and partial root paths is done within the Services.yaml file:

# Configuration/Services.yaml

handlebars:
  template:
    template_root_paths:
      10: EXT:my_extension/Resources/Private/Templates
    partial_root_paths:
      10: EXT:my_extension/Resources/Private/Partials

The HandlebarsExtension takes care of all template paths. They will be merged and then added to the service container resulting in the following parameters:

  • %handlebars.template_root_paths%
  • %handlebars.partial_root_paths%

You can reference those parameters in your custom configuration to use the resolved template paths in your services.

Note

Configuration of template paths in multiple extensions

If template paths are defined multiple times (e.g. within various extensions that provide Handlebars templates), the ones with the same numeric key will be overridden by the last defined one.