WC_Settings_Emails::email_preview_single
Creates the React mount point for the single email preview.
Method of the class: WC_Settings_Emails{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_Settings_Emails = new WC_Settings_Emails(); $WC_Settings_Emails->email_preview_single( $email );
- $email(object) (required)
- The email object to run the method on.
WC_Settings_Emails::email_preview_single() WC Settings Emails::email preview single code WC 10.3.6
<?php
public function email_preview_single( $email ) {
$this->delete_transient_email_settings();
// Email types array should have a single entry for current email.
$email_types = array(
array(
'label' => $email->get_title(),
'value' => get_class( $email ),
),
);
?>
<h2><?php echo esc_html( __( 'Email preview', 'woocommerce' ) ); ?></h2>
<p><?php echo esc_html( __( 'Preview your email template. You can also test on different devices and send yourself a test email.', 'woocommerce' ) ); ?></p>
<div>
<div
id="wc_settings_email_preview_slotfill"
data-preview-url="<?php echo esc_url( wp_nonce_url( admin_url( '?preview_woocommerce_mail=true' ), 'preview-mail' ) ); ?>"
data-email-types="<?php echo esc_attr( wp_json_encode( $email_types ) ); ?>"
data-email-setting-ids="<?php echo esc_attr( wp_json_encode( EmailPreview::get_email_content_setting_ids( $email->id ) ) ); ?>"
></div>
<input type="hidden" id="woocommerce_email_from_name" value="<?php echo esc_attr( get_option( 'woocommerce_email_from_name' ) ); ?>" />
<input type="hidden" id="woocommerce_email_from_address" value="<?php echo esc_attr( get_option( 'woocommerce_email_from_address' ) ); ?>" />
</div>
<?php
}