Skip to content

Commit

Permalink
Fix “All Fields” and similar summary variables causing invalid HTML i…
Browse files Browse the repository at this point in the history
…n some email clients for email notifications
  • Loading branch information
engram-design committed Apr 5, 2024
1 parent 2818cbf commit d91b8d6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/helpers/Variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ public static function getParsedValue(mixed $value, Submission $submission = nul
if ($includeSummary) {
// Populate a collection of fields for "all", "visible" and "with-content"
$fieldVariables = self::getFormFieldsVariables($form, $notification, $submission);

// We should also re-format the string to remove `<p>` tags from variables, which might produce invalid HTML
// but just for these summary tags which are block-level
$value = str_replace(['<p>{allFields}</p>'], '{allFields}', $value);
$value = str_replace(['<p>{allContentFields}</p>'], '{allContentFields}', $value);
$value = str_replace(['<p>{allVisibleFields}</p>'], '{allVisibleFields}', $value);
}

// Properly parse field values. There's seemingly performance benefits to doing this separate to the above
Expand Down

0 comments on commit d91b8d6

Please sign in to comment.