From 8821bf41c519065cef192717a9458999f6479784 Mon Sep 17 00:00:00 2001 From: jlavoie13 Date: Fri, 6 Nov 2020 11:37:56 -0500 Subject: [PATCH 1/2] pass email object to header and footer templates --- includes/class-wc-emails.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/class-wc-emails.php b/includes/class-wc-emails.php index e4aeb5c185d..36cefe958e2 100644 --- a/includes/class-wc-emails.php +++ b/includes/class-wc-emails.php @@ -190,7 +190,7 @@ class WC_Emails { $this->init(); // Email Header, Footer and content hooks. - add_action( 'woocommerce_email_header', array( $this, 'email_header' ) ); + add_action( 'woocommerce_email_header', array( $this, 'email_header' ), 10, 2 ); add_action( 'woocommerce_email_footer', array( $this, 'email_footer' ) ); add_action( 'woocommerce_email_order_details', array( $this, 'order_downloads' ), 10, 4 ); add_action( 'woocommerce_email_order_details', array( $this, 'order_details' ), 10, 4 ); @@ -264,16 +264,19 @@ class WC_Emails { * Get the email header. * * @param mixed $email_heading Heading for the email. + * @param WC_Email $email Email object for the email. */ - public function email_header( $email_heading ) { - wc_get_template( 'emails/email-header.php', array( 'email_heading' => $email_heading ) ); + public function email_header( $email_heading, $email ) { + wc_get_template( 'emails/email-header.php', array( 'email_heading' => $email_heading, 'email' => $email ) ); } /** * Get the email footer. + * + * @param WC_Email $email Email object for the email. */ - public function email_footer() { - wc_get_template( 'emails/email-footer.php' ); + public function email_footer( $email ) { + wc_get_template( 'emails/email-footer.php', array( 'email' => $email ) ); } /** From 27f9f1304ce307b17de7f18f09b7e79277955980 Mon Sep 17 00:00:00 2001 From: jlavoie13 Date: Fri, 13 Nov 2020 13:42:52 -0500 Subject: [PATCH 2/2] phpcs fixes --- includes/class-wc-emails.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/includes/class-wc-emails.php b/includes/class-wc-emails.php index 36cefe958e2..338c8caff18 100644 --- a/includes/class-wc-emails.php +++ b/includes/class-wc-emails.php @@ -263,11 +263,17 @@ class WC_Emails { /** * Get the email header. * - * @param mixed $email_heading Heading for the email. - * @param WC_Email $email Email object for the email. + * @param mixed $email_heading Heading for the email. + * @param WC_Email $email Email object for the email. */ public function email_header( $email_heading, $email ) { - wc_get_template( 'emails/email-header.php', array( 'email_heading' => $email_heading, 'email' => $email ) ); + wc_get_template( + 'emails/email-header.php', + array( + 'email_heading' => $email_heading, + 'email' => $email, + ) + ); } /**