Render a Template - supported Twig Filters

Hi Alumio,

I’m really happy with the Render a Template / Twig support. But, I’ve tried using it and finding that many filters (which seem innocuous to me) aren’t enabled. So far, I’ve found both slice and length being disabled. These are important filters (e.g. check on the length of an array, or sub-stringing a string).

Are you working with a ‘whitelist’ of filters in Twig? Could you share which filters are enabled? And is it possible to enable more filters?

Thanks in advance!

Hi @floris

Thank you for your feedback.

I agree that the filters are important ones to have when doing templating with Twig. I’ll check with the team to see whether we have the list of enabled/disabled filters. We will get back to you once we have an update.

Hi @floris,

You are correct that we have a list of filters we allow to use in the Template Transformer. Please find the list below.

  • upper
  • lower
  • capitalize
  • title
  • abs
  • round
  • escape
  • number_format
  • default
  • e
  • striptags

It should be possible adding more filters, but let me verify with the corresponding team. We will keep you posted.

Hi @floris,

We have a good news that we can add more filters to the list. Could you please provide us with the list of Twig filters that may benefit you and other users?

Hi Gugi,

Thanks for your response!

Honestly, I’d kind of turn it around. I’d say just enable all filters from the Twig documentation ( Documentation - Twig - The flexible, fast, and secure PHP template engine ) unless there are security concerns with the specific filter.

I mean, I could say something useful about all of those filters (like the ‘url_encode’, though you could ofcourse also do that with Alumio native tools).

Thanks in advance!

Hi @floris,

Thank you for your response. We have passed it to the corresponding team for further check. We will get back to you once we have an update.

Hi @floris,

Thanks for your feedback and interest in this feature! We are happy to let you know that the requested functionality will be available starting from version 3.94.0.

In this release, we will support the following Twig tags and filters:

Tags

  • if
  • for

Filters

  • abs
  • batch
  • capitalize
  • default
  • e
  • escape
  • first
  • format
  • join
  • keys
  • last
  • length
  • lower
  • nl2br
  • number_format
  • replace
  • reverse
  • round
  • striptags
  • title
  • trim
  • upper
  • url_encode

You can follow our release notes here to stay updated on the rollout and any changes: Release Notes

1 Like