|
7 | 7 | use Illuminate\Queue\SerializesModels; |
8 | 8 | use Statamic\Contracts\Forms\Submission; |
9 | 9 | use Statamic\Facades\Antlers; |
| 10 | +use Statamic\Facades\Blueprint; |
10 | 11 | use Statamic\Facades\Config; |
| 12 | +use Statamic\Facades\Form; |
11 | 13 | use Statamic\Facades\GlobalSet; |
12 | 14 | use Statamic\Facades\Parse; |
13 | 15 | use Statamic\Sites\Site; |
@@ -155,13 +157,18 @@ private function attachFiles($field) |
155 | 157 | protected function addData() |
156 | 158 | { |
157 | 159 | $augmented = $this->submission->toAugmentedArray(); |
| 160 | + $form = $this->submission->form(); |
158 | 161 | $fields = $this->getRenderableFieldData(Arr::except($augmented, ['id', 'date', 'form'])) |
159 | 162 | ->reject(fn ($field) => $field['fieldtype'] === 'spacer') |
160 | 163 | ->when(Arr::has($this->config, 'attachments'), function ($fields) { |
161 | 164 | return $fields->reject(fn ($field) => in_array($field['fieldtype'], ['assets', 'files'])); |
162 | 165 | }); |
| 166 | + $formConfig = ($configFields = Form::extraConfigFor($form->handle())) |
| 167 | + ? Blueprint::makeFromTabs($configFields)->fields()->addValues($form->data()->all())->values()->all() |
| 168 | + : []; |
163 | 169 |
|
164 | 170 | $data = array_merge($augmented, $this->getGlobalsData(), [ |
| 171 | + 'form_config' => $formConfig, |
165 | 172 | 'email_config' => $this->config, |
166 | 173 | 'config' => config()->all(), |
167 | 174 | 'fields' => $fields, |
|
0 commit comments