| @@ -302,12 +302,46 @@ | ||
| 302 | 302 | return $guest->getTotalGuestCount(); |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | if ($key == 'form_data_html') { |
| 306 | - return __('will be available soon', 'fluent-booking'); | |
| 306 | + // isPublic: hidden fields stay out, the recipient may be the guest. | |
| 307 | + return self::renderFormData( | |
| 308 | + BookingFieldService::getFormattedCustomBookingData($guest, static::$requireHtml, true), | |
| 309 | + static::$requireHtml | |
| 310 | + ); | |
| 307 | 311 | } |
| 308 | 312 | |
| 309 | 313 | return self::resolveScalarAttribute($guest, $key); |
| 314 | + } | |
| 315 | + | |
| 316 | + protected static function renderFormData($fields, $isHtml) | |
| 317 | + { | |
| 318 | + $rows = ''; | |
| 319 | + | |
| 320 | + foreach ($fields as $field) { | |
| 321 | + $value = Arr::get($field, 'value'); | |
| 322 | + | |
| 323 | + if ($value === '' || $value === null || $value === []) { | |
| 324 | + continue; | |
| 325 | + } | |
| 326 | + | |
| 327 | + if (!$isHtml) { | |
| 328 | + $rows .= $field['label'] . ': ' . $value . PHP_EOL; | |
| 329 | + continue; | |
| 330 | + } | |
| 331 | + | |
| 332 | + // File values are download anchors; everything else is raw guest input. | |
| 333 | + $value = Arr::get($field, 'type') == 'file' ? wp_kses_post($value) : nl2br(esc_html($value)); | |
| 334 | + | |
| 335 | + $rows .= '<tr><th style="padding:6px 12px;background-color:#f8f8f8;text-align:' . (is_rtl() ? 'right' : 'left') . ';">' . esc_html($field['label']) . '</th></tr>' | |
| 336 | + . '<tr><td style="padding:6px 12px 12px 12px;">' . $value . '</td></tr>'; | |
| 337 | + } | |
| 338 | + | |
| 339 | + if (!$isHtml || !$rows) { | |
| 340 | + return trim($rows); | |
| 341 | + } | |
| 342 | + | |
| 343 | + return '<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:collapse;"><tbody>' . $rows . '</tbody></table>'; | |
| 310 | 344 | } |
| 311 | 345 | |
| 312 | 346 | protected static function getBookingEventData($key) |
| 313 | 347 | { |