Skip to content

Commit 3c951b1

Browse files
committed
Add WP emoji styles
1 parent ce67626 commit 3c951b1

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

projects/packages/forms/src/contact-form/class-response-pdf.php

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,14 @@ private function get_form_html( $feedback_id ) {
205205

206206
// Todo add flag when emoji support is added in Dompdf.
207207
if ( $response->get_ip_address() ) {
208+
$ip_address = '<span class="ip-address">' .
209+
( $response->get_country_flag() ? $response->get_country_flag() . ' ' : '' ) . $response->get_ip_address()
210+
. '</span>';
211+
208212
$header .= sprintf(
209213
/* translators: Placeholder is the IP address of the person who submitted a form. */
210214
esc_html__( 'IP Address: %1$s', 'jetpack-forms' ),
211-
( $response->get_country_flag() ? $response->get_country_flag() . ' ' : '' ) . $response->get_ip_address()
215+
$ip_address
212216
);
213217
$header .= '<br/>';
214218
}
@@ -227,10 +231,36 @@ private function get_form_html( $feedback_id ) {
227231
$message = implode( '', self::get_compiled_form_fields( $feedback_id, null ) );
228232

229233
$styles = '<style>
234+
/**
235+
* From wp_enqueue_emoji_styles()
236+
* https://github.com/WordPress/WordPress/blob/b924099da883c55c513087fef74e59ae626ebfb4/wp-includes/formatting.php#L5888-L5898
237+
*/
238+
img.wp-smiley, img.emoji {
239+
display: inline !important;
240+
border: none !important;
241+
box-shadow: none !important;
242+
height: 1em !important;
243+
width: 1em !important;
244+
margin: 0 0.07em !important;
245+
vertical-align: -0.1em !important;
246+
background: none !important;
247+
padding: 0 !important;
248+
}
249+
250+
body {
251+
font-size: 14px;
252+
}
253+
230254
a {
231255
color: #000;
232256
text-decoration: none;
233257
}
258+
259+
/* Align the flag with the IP */
260+
.ip-address {
261+
display: inline-block;
262+
vertical-align: middle !important;
263+
}
234264
</style>';
235265

236266
// Dompdf does not support emojis: https://github.com/dompdf/dompdf/issues/1698,

0 commit comments

Comments
 (0)