-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core/api): new submission view endpoint (#851)
- Loading branch information
1 parent
f3b65c4
commit 59e1dc4
Showing
3 changed files
with
52 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,14 +10,14 @@ [email protected] | |
|
||
Or dynamically: | ||
```twig | ||
{%- spaceless -%} | ||
{%- apply spaceless -%} | ||
{%- set destination = "[email protected]" -%} | ||
{%- if data.my_destination_field is same as("my_destination_value") -%} | ||
{%- set destination = "[email protected]" -%} | ||
{%- endif -%} | ||
{%- endspaceless -%} | ||
{%- endapply -%} | ||
{{- destination -}} | ||
``` | ||
|
||
|
@@ -89,10 +89,11 @@ You can also define a `reply-to` option: | |
} %} | ||
{% endautoescape %} | ||
{{ email|js | ||
``` | ||
|
||
### Attachments | ||
|
||
Use the **formData** helper object to retreive all files that are attached to the form submission. | ||
Use the **formData** helper object to retrieve all files that are attached to the form submission. | ||
You can override the default values for each file using the `map` filter as shown below. | ||
|
||
```twig | ||
|
@@ -106,23 +107,14 @@ You can override the default values for each file using the `map` filter as show | |
{% set email = { | ||
"from": data.email, | ||
"subject": "Email Form subject", | ||
"body": body | ||
"body": body, | ||
"attachments": formData.allFiles|map(v => v.toArray)|map(f => { | ||
filename: f.originalName|ems_webalize, | ||
mimeType: f.mimeType, | ||
pathname: f.pathname, | ||
}) | ||
} %} | ||
{%- set files = {} -%} | ||
{% for file in formData.allFiles|map(v => v.toArray) %} | ||
{%- set files = files|merge({(file.form_field):{ | ||
filename: file.filename|ems_slug, | ||
originalName: file.filename|ems_slug, | ||
mimeType: file.mimeType, | ||
pathname: file.pathname, | ||
} }) -%} | ||
{% endfor %} | ||
{% if files|length > 0 %} | ||
{% set email = email|merge({"attachments": files}) %} | ||
{% endif %} | ||
{% endautoescape %} | ||
{{ email|json_encode|raw }} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters