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

feat: email styles

parent 44881e2d
No related branches found
No related tags found
2 merge requests!3feat: email styles,!2Devel
Pipeline #400621 passed with warnings with stages
in 38 seconds
......@@ -5,7 +5,7 @@ namespace WPDesk\Library\WPEmail;
use WPDesk\Library\WPEmail\Helpers\StyleInliner;
use WPDesk\View\Renderer\Renderer;
class EmailTemplate {
class Template {
/**
* @var Renderer
......@@ -22,7 +22,7 @@ class EmailTemplate {
$this->template_attributes = wp_parse_args( $template_attributes, $this->get_default_template_attributes() );
}
public function get_email_template( string $content ): string {
public function get_body( string $content ): string {
$output = $this->renderer->render( 'html/email-header', $this->template_attributes );
$output .= $this->renderer->render( 'html/email-content', [ 'content' => $content ] );
$output .= $this->renderer->render( 'html/email-footer', [ 'footer' => $this->template_attributes['footer'] ] );
......
......@@ -12,7 +12,6 @@ use WPDesk\View\Renderer\SimplePhpRenderer;
use WPDesk\View\Resolver\ChainResolver;
use WPDesk\View\Resolver\DirResolver;
class WPMailer implements Mailer {
/**
......@@ -54,13 +53,13 @@ class WPMailer implements Mailer {
);
add_action( 'wp_mail_failed', [ $this, 'catch_error' ] );
$email_template = new EmailTemplate( $this->renderer, $email->get_template_attributes() );
$email_template = new Template( $this->renderer, $email->get_template_attributes() );
try {
$success = wp_mail(
$email->get_recipients(),
$email->get_subject(),
$email_template->get_email_template( $email->get_content() ),
$email_template->get_body( $email->get_content() ),
$email->get_headers(),
$email->get_attachments()
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment