verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
95 stars 72 forks source link

Translating e-mails - Unknown "t" filter [2.1.6] [Craft 4] #1765

Closed davidwebca closed 6 months ago

davidwebca commented 6 months ago

Describe the bug

Hi!

I've lately updated a website with Craft 4's latest version and Formie's latest compatible version too. Somehow, I've lost the ability to translate both the subject of e-mail notifications (queue job fails) and e-mail contents (queue job also fails). I get the following error: Error parsing template: “{{ 'Thanks for contacting us!'|t('formie') }}”: “Unknown "t" filter. Did you mean "date", "trim", "sort", "last", "title", "split", "batch", "first", "format", "filter", "length", "default", "striptags", "capitalize", "date_modify", "number_format", "convert_encoding"

Steps to reproduce

  1. Create a form
  2. Add an e-mail notification
  3. Use the "t" twig filter in the subject and content
  4. Set formie to use the queue runner and run a cron job separately
  5. Notice the notifications not sending

Form settings

Craft CMS version

4.8.2

Plugin version

2.1.6

Multi-site?

Yes

Additional context

Here's the list of plugins installed currently

Name                 Handle              Package Name                        Version   Installed  Enabled
-------------------  ------------------  ----------------------------------  --------  ---------  -------
Blitz                blitz               putyourlightson/craft-blitz         4.13.1    Yes        Yes
Field Manager        field-manager       verbb/field-manager                 3.0.8     Yes        Yes
Fix FKs              fix-fks             craftcms/fix-fks                    2.0.0     Yes        Yes
Formie               formie              verbb/formie                        2.1.6     Yes        Yes
GDPR Cookie Consent  cookie-consent      elleracompany/craft-cookie-consent  4.0.4     Yes        Yes
Hyper                hyper               verbb/hyper                         1.1.21    Yes        Yes
Icon Picker          icon-picker         verbb/icon-picker                   2.0.17    Yes        Yes
Inline SVG           inlinesvg           clubstudioltd/craft-inline-svg      2.0.0     Yes        Yes
Maps                 simplemap           ether/simplemap                     v4.x-dev  Yes        Yes
Navigation           navigation          verbb/navigation                    2.0.26    Yes        Yes
Neo                  neo                 spicyweb/craft-neo                  4.0.7     Yes        Yes
Redactor             redactor            craftcms/redactor                   3.0.4     Yes        Yes
Retour               retour              nystudio107/craft-retour            4.1.15    Yes        Yes
SendGrid             sendgrid            putyourlightson/craft-sendgrid      2.0.1     Yes        Yes
SEOmatic             seomatic            nystudio107/craft-seomatic          4.0.43    Yes        Yes
Translations admin   translations-admin  mutation/translate                  3.2.3     Yes        Yes
Vite                 vite                nystudio107/craft-vite              4.0.9     Yes        Yes
engram-design commented 6 months ago

This is probably due to our efforts to tighten what kind of Twig is allowed in dynamic fields, as there's security implications to allowing any Twig to be included in there. Looks like we forgot about the t filter!

This will be fixed upstream at our verbb-base helper, so will tag a new Formie release shortly. Otherwise, to get this early, run composer require verbb/base:2.0.5.

engram-design commented 6 months ago

Fixed in 2.1.7