Skip to content

Commit

Permalink
[5.x] Filter out Spacer fields from form emails (#10710)
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean authored Sep 3, 2024
1 parent 5db4f65 commit 6a1ba7b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Forms/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ private function attachFiles($field)
protected function addData()
{
$augmented = $this->submission->toAugmentedArray();
$fields = $this->getRenderableFieldData(Arr::except($augmented, ['id', 'date', 'form']));

if (Arr::has($this->config, 'attachments')) {
$fields = $fields->reject(fn ($field) => in_array($field['fieldtype'], ['assets', 'files']));
}
$fields = $this->getRenderableFieldData(Arr::except($augmented, ['id', 'date', 'form']))
->reject(fn ($field) => $field['fieldtype'] === 'spacer')
->when(Arr::has($this->config, 'attachments'), function ($fields) {
return $fields->reject(fn ($field) => in_array($field['fieldtype'], ['assets', 'files']));
});

$data = array_merge($augmented, $this->getGlobalsData(), [
'config' => config()->all(),
Expand Down

0 comments on commit 6a1ba7b

Please sign in to comment.