Extending Twig Configuration
Twig is the template engine used by Copilot in a lot of places. To ensure a certain level of security and to provide a better user experience, Copilot uses a custom Twig environment. This environment is, per default, limited to a certain set of functions, tags and filters. However, you can extend this configuration to allow more or restrict functions, tags and filters.
How to extend the allowed functions, tags and filters
You can add the functions
, tags
and filters
arrays to your configuration.
caution
Please make sure to include all tags, functions and filters used in the inline help files.
pimcore_copilot:
twig:
sandbox_security_policy:
tags:
- 'if'
- 'for'
functions:
- 'range'
- 'date'
filters:
- 'upper'
- 'lower'
- 'raw'
Example configuration including default values
The example configuration show in the following snippet includes all default values.
pimcore_copilot:
twig:
sandbox_security_policy:
tags:
- 'if'
- 'for'
- 'set'
functions:
- 'range'
- 'date'
- 'max'
- 'min'
- 'random'
filters:
- 'escape'
- 'raw'
- 'date'
- 'length'
- 'upper'
- 'lower'
- 'title'
- 'number_format'
- 'capitalize'
- 'first'
- 'last'
- 'trim'
- 'join'
- 'replace'