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 {
public function get_template( EmailInterface $email, $placeholders = [] ): string {
$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-footer', [] );
......@@ -149,7 +149,8 @@ class EmailSender {
*/
private function css_inline( string $content ): string {
$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;
<table border="0" cellpadding="10" cellspacing="0" width="100%">
<tr>
<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>
</tr>
</table>
......
......@@ -19,6 +19,8 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
$params = isset( $params ) ? $params : [];
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
......@@ -33,8 +35,8 @@ if ( ! defined( 'ABSPATH' ) ) {
<td align="center" valign="top">
<div id="template_header_image">
<?php
if ( $img = get_option( 'woocommerce_email_header_image' ) ) {
echo '<p style="margin-top:0;"><img src="' . esc_url( $img ) . '" alt="' . get_bloginfo( 'name', 'display' ) . '" /></p>';
if ( $params['logo'] ) {
echo '<p style="margin-top:0;"><img src="' . esc_url( $params['logo'] ) . '" alt="' . get_bloginfo( 'name', 'display' ) . '" /></p>';
}
?>
</div>
......@@ -45,7 +47,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="template_header">
<tr>
<td id="header_wrapper">
<h1><?php echo $email_heading; ?></h1>
<h1><?php echo $params['heading']; ?></h1>
</td>
</tr>
</table>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment