Skip to content

Commit bc76c50

Browse files
authored
gwaft-template-compare.php: Updated to use <table> markup and style attributes for better compat with email clients.
1 parent 2e9d14c commit bc76c50

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

gravity-forms/gwaft-template-compare.php

+17-22
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,29 @@
2222
return $content;
2323
}
2424
$original_entry = gw_all_fields_template()->get_original_entry();
25+
ob_start();
2526
?>
26-
<div class="gwaft-compare-grid">
27+
<table style="width: 100%; border-collapse: collapse; margin-top: 1rem;">
28+
<thead>
29+
<tr>
30+
<th style="text-align: left; border-bottom: 2px solid #ddd; padding: 0.5rem;">Field</th>
31+
<th style="text-align: left; border-bottom: 2px solid #ddd; padding: 0.5rem;">Previous Value</th>
32+
<th style="text-align: left; border-bottom: 2px solid #ddd; padding: 0.5rem;">Current Value</th>
33+
</tr>
34+
</thead>
35+
<tbody>
2736
<?php foreach ( $data['items'] as $item ):
2837
$raw_field_value = GFFormsModel::get_lead_field_value( $original_entry, $item['field'] );
2938
$previous_value = GFCommon::get_lead_field_display( $item['field'], $raw_field_value, rgar( $original_entry, 'currency' ), true, 'html', 'email' );
3039
?>
31-
<div class="gwaft-compare-label"><?php echo $item['label']; ?></div>
32-
<div class="gwaft-compare-prev"><?php echo $previous_value; ?></div>
33-
<div class="gwaft-compare-current"><?php echo $item['value']; ?></div>
40+
<tr>
41+
<td style="padding: 0.5rem; border-bottom: 1px solid #ddd;"><?php echo esc_html( $item['label'] ); ?></td>
42+
<td style="padding: 0.5rem; border-bottom: 1px solid #ddd;"><?php echo $previous_value; ?></td>
43+
<td style="padding: 0.5rem; border-bottom: 1px solid #ddd;"><?php echo $item['value']; ?></td>
44+
</tr>
3445
<?php endforeach; ?>
35-
</div>
36-
<?php
37-
?>
38-
<style>
39-
.gwaft-compare-grid {
40-
display: grid;
41-
grid-template-columns: 1fr 1fr 1fr;
42-
margin-top: 1rem;
43-
padding: 0.5rem;
44-
}
45-
.gwaft-compare-grid > div {
46-
padding: 0.5rem;
47-
border-bottom: 1px solid #ddd;
48-
}
49-
.gwaft-compare-label {
50-
font-weight: bold;
51-
}
52-
</style>
46+
</tbody>
47+
</table>
5348
<?php
5449
return ob_get_clean();
5550
}, 10, 5 );

0 commit comments

Comments
 (0)