Merge pull request #28204 from jlavoie13/add/pass-email-object-to-template-parts
Pass email object to header and footer templates
This commit is contained in:
commit
7f4ad80cbd
|
@ -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 );
|
||||
|
@ -263,17 +263,26 @@ class WC_Emails {
|
|||
/**
|
||||
* Get the email header.
|
||||
*
|
||||
* @param mixed $email_heading Heading 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 ) {
|
||||
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 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue