Problem/Motivation

When using tokens for fields that are optional, they are not cleared when kept empty.

Steps to reproduce

  • Configure a name field with first and last name, both optional
  • Specify tokens in the Brevo Webform handler: [webform_submission:values:name:last], [webform_submission:values:name:first]
  • Submit the form and leave those fields empty

Expected result: In Brevo, the FIRSTNAME and LASTNAME fields are empty
Acutal result: They contain the token values [webform_submission:values:name:last] and [webform_submission:values:name:first]

Proposed resolution

Use the clear option when replacing tokens. Also, remove the local $token_manager property since we're already inheriting $tokenManager from the base class.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mrshowerman created an issue. See original summary.

mrshowerman’s picture

Assigned: mrshowerman » Unassigned
Status: Active » Needs review
finex’s picture

Status: Needs review » Fixed
mrshowerman’s picture

Wow. No credit at all?

finex’s picture

I'm very sorry, I thought it was automatic. I've just edited the release description message!

finex’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.