Skip to content
Snippets Groups Projects
Commit b9bf52cb authored by Piotr Potrebka's avatar Piotr Potrebka
Browse files

feat: email abstract

parent 87263a6c
No related branches found
No related tags found
1 merge request!2Devel
Pipeline #151260 passed
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
...@@ -125,7 +125,7 @@ class EmailSender { ...@@ -125,7 +125,7 @@ class EmailSender {
public function get_template( EmailInterface $email, $placeholders = [] ): string { public function get_template( EmailInterface $email, $placeholders = [] ): string {
$content = $this->replace_placeholders( $email->get_content(), $placeholders ); $content = $this->replace_placeholders( $email->get_content(), $placeholders );
$output = $this->renderer->render( 'html/email-header', [] ); $output = $this->renderer->render( 'html/email-header', [ 'heading' => $email->get_heading(), 'logo' => '' ] );
$output .= $this->renderer->render( 'html/' . $email->get_id(), [ 'content' => $content ] ); $output .= $this->renderer->render( 'html/' . $email->get_id(), [ 'content' => $content ] );
$output .= $this->renderer->render( 'html/email-footer', [] ); $output .= $this->renderer->render( 'html/email-footer', [] );
...@@ -149,7 +149,8 @@ class EmailSender { ...@@ -149,7 +149,8 @@ class EmailSender {
*/ */
private function css_inline( string $content ): string { private function css_inline( string $content ): string {
$styles = $this->renderer->render( 'html/email-styles', [] ); $styles = $this->renderer->render( 'html/email-styles', [] );
$body = HTMLDecorator::style_inline( $content, $styles );
return HTMLDecorator::style_inline( $content, $styles );
} }
/** /**
......
...@@ -40,7 +40,7 @@ defined( 'ABSPATH' ) || exit; ...@@ -40,7 +40,7 @@ defined( 'ABSPATH' ) || exit;
<table border="0" cellpadding="10" cellspacing="0" width="100%"> <table border="0" cellpadding="10" cellspacing="0" width="100%">
<tr> <tr>
<td colspan="2" valign="middle" id="credit"> <td colspan="2" valign="middle" id="credit">
<?php echo wp_kses_post( wpautop( wptexturize( apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) ) ) ) ); ?> <?php echo wp_kses_post( wpautop( wptexturize( apply_filters( 'wpdesk/wp_mail/template/footer', '' ) ) ) ); ?>
</td> </td>
</tr> </tr>
</table> </table>
......
...@@ -19,6 +19,8 @@ if ( ! defined( 'ABSPATH' ) ) { ...@@ -19,6 +19,8 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly
} }
$params = isset( $params ) ? $params : [];
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html <?php language_attributes(); ?>> <html <?php language_attributes(); ?>>
...@@ -33,8 +35,8 @@ if ( ! defined( 'ABSPATH' ) ) { ...@@ -33,8 +35,8 @@ if ( ! defined( 'ABSPATH' ) ) {
<td align="center" valign="top"> <td align="center" valign="top">
<div id="template_header_image"> <div id="template_header_image">
<?php <?php
if ( $img = get_option( 'woocommerce_email_header_image' ) ) { if ( $params['logo'] ) {
echo '<p style="margin-top:0;"><img src="' . esc_url( $img ) . '" alt="' . get_bloginfo( 'name', 'display' ) . '" /></p>'; echo '<p style="margin-top:0;"><img src="' . esc_url( $params['logo'] ) . '" alt="' . get_bloginfo( 'name', 'display' ) . '" /></p>';
} }
?> ?>
</div> </div>
...@@ -45,7 +47,7 @@ if ( ! defined( 'ABSPATH' ) ) { ...@@ -45,7 +47,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="template_header"> <table border="0" cellpadding="0" cellspacing="0" width="100%" id="template_header">
<tr> <tr>
<td id="header_wrapper"> <td id="header_wrapper">
<h1><?php echo $email_heading; ?></h1> <h1><?php echo $params['heading']; ?></h1>
</td> </td>
</tr> </tr>
</table> </table>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment