I need to email multiple addresses from a composite element in a webform. Using a Computed Twig element with this code:
{% for m in data.member_information %}
{{ m.email }}
{% endfor %}
The email addresses are listed line by line in Results.
[email protected]
[email protected]
I guess that means they're in an array, but I'm not sure. Here's the configuration of the composite element:
id: member_information
uuid: 591d262f-998d-4ade-8e40-56d8119592dd
status: true
label: 'Member Information'
elements: |
first_name:
'#type': textfield
'#required': true
'#title': 'First Name'
middle_name:
'#type': textfield
'#title': 'Middle Name'
last_name:
'#type': textfield
'#required': true
'#title': 'Last Name'
phone:
'#type': tel
'#required': true
'#title': Phone
cell_phone:
'#type': tel
'#title': 'Cell Phone'
email:
'#type': email
'#required': true
'#title': Email
description: 'Group Nomination composite.'
langcode: en
dependencies: { }
The configuration uses the webform composite module.
In the handler, the email addresses need to be a comma separated list in the To email field, like this:
[email protected],[email protected]
I've tried
{% for m in data.member_information %}
{{ m.email|join(',') }}
{% endfor %}
In Results, email addresses are still listed line by line.
How do I convert the line separated list to a comma separated string in the twig template?